The default flags passed to sudo sudo_flags=-Hi

Hi List,

I’m trying to add the “-i” sudo option to the sudo_flags= configuration option in the ansible.cfg like so:

the default flags passed to sudo

sudo_flags=-Hi

This is because I want some things to run under the oracle user in my playbook, meaning it needs it’s environment set properly (Like ORACLE_HOME)

But when I add the option, ansible does not even go past “GATHERING FACTS”:

mmaas@xmgtansible:~/playbooks$ ansible-playbook binck/site.yml --extra-vars hosts=t2wwwkripke --tags=users-dba -vvvvv

sudo password:

PLAY [t2wwwkripke] *********************

GATHERING FACTS *********************

ESTABLISH CONNECTION FOR USER: mmaas on PORT 22 TO t2wwwkripke

EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1360227274.82-278808592316494 && chmod a+rx $HOME/.ansible/tmp/ansible-1360227274.82-278808592316494 && echo $HOME/.ansible/tmp/ansible-1360227274.82-278808592316494’

REMOTE_MODULE setup

PUT /tmp/tmp4SHl9r TO /home/mmaas/.ansible/tmp/ansible-1360227274.82-278808592316494/setup

EXEC /bin/sh -c ‘sudo -k && sudo -Hi -S -p “[sudo via ansible, key=ijizcovnimrhdctfmrswznnvqgfpibhz] password: " -u root /bin/sh -c '”’“‘/usr/bin/python /home/mmaas/.ansible/tmp/ansible-1360227274.82-278808592316494/setup; rm -rf /home/mmaas/.ansible/tmp/ansible-1360227274.82-278808592316494/ >/dev/null 2>&1’”‘"’’

At that point I have to CTRL-c to stop the playbook run.
The ansible version is 1.1

Any suggestions? Thanks!

I believe sudo "-i" tends to cause problems.

"-H", however should be good to go.

I'm going to be adding some features very very very very soon to allow
environments to get set in commands for specific variables that should
resolve this issue
very well.

Until then, a workaround may be to use the command module in a few
places. This is suboptimal, but will work.

ETA is probably a week or two, adding the environment feature is
actually going to be pretty easy for us, and will also enable some
other things.

Ticket is already open (talking about proxies)

Soo basicly you read my mind?! :wink:
Awesome, looking forward to the next update then.

And I did not know that the command module already loads the environment, good stuff!

Soo basicly you read my mind?! :wink:
Awesome, looking forward to the next update then.

And I did not know that the command module already loads the environment,
good stuff!

shell one should at least?

anyway, I was thinking like this:

shell: ORACLE_HOME=$splat oracle-command-here --some-arguments=1234

which I'm going to add like

shell: ...
environment: $environment

where $environment is either a variable that is a hash, or a hash.