devops:ansible
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| devops:ansible [2018/10/18 10:29] – [Importing and Including] skipidar | devops:ansible [2023/11/01 07:15] (current) – ↷ Page moved from camunda:devops:ansible to devops:ansible skipidar | ||
|---|---|---|---|
| Line 398: | Line 398: | ||
| ==== Read remote files ==== | ==== Read remote files ==== | ||
| + | To read remote file do use slurp | ||
| + | |||
| < | < | ||
| Line 419: | Line 421: | ||
| | | ||
| </ | </ | ||
| + | |||
| + | |||
| + | ==== Execute a shell script, as a user with a valid environment ==== | ||
| + | Sometimes you face the issues, that the environment variables defined by some tool, installed for a special user - are not defined, when you execute the tool. | ||
| + | |||
| + | To execute some installed software in a valid environment, | ||
| + | with / | ||
| + | with / | ||
| + | etc | ||
| + | |||
| + | use the following approach. | ||
| + | |||
| + | < | ||
| + | # unfortunately the environment defined by tool in / | ||
| + | - name: processing step | ||
| + | shell: | ||
| + | sudo -iu ubuntu yourtool.sh | ||
| + | args: | ||
| + | executable: /bin/bash | ||
| + | |||
| + | |||
| + | -i [command] | ||
| + | The -i (simulate initial login) option runs the shell specified in the passwd(5) entry of the target user as a login shell. | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | </ | ||
| + | See https:// | ||
| + | |||
| + | UNfortunately the aproach with become_user - does not have the same result | ||
| + | |||
devops/ansible.1539858592.txt.gz · Last modified: (external edit)
