in your ansible.cfg have you set tried setting "sudo_flags=-H -i" ? this
would make the sudo invoke a login shell


- Benno


On Wed, May 20, 2015 at 11:02 AM, Adrian Paraschiv <
[email protected]> wrote:

> I have modified ~/.bashrc for root and ansible user to include : alias
> sudo="sudo -i" and also modified ansible.cfg : executable = /bin/bash
>
> [ansible@ACEPP-LM-01 ~]$ sudo env | grep ENV
> ENV=PP
> ENV_PROP=preprod
> ENV_PROP_PREFIX=preprod
> [ansible@ACEPP-LM-01 ~]$ sudo env | grep SUDO
> SUDO_USER=ansible
> SUDO_UID=30001
> SUDO_COMMAND=/bin/bash -c env
> SUDO_GID=30001
> [ansible@ACEPP-LM-01 ~]$ env | grep ENV
> ENV=PP
> ENV_PROP=preprod
> ENV_PROP_PREFIX=preprod
>
> and when I run a "shell: echo $ENV && env && whoami && cat ~/.bashrc"
> I get this:
>
> stdout:
>
> TERM=xterm
> SHELL=/bin/bash
> USER=root
> SUDO_USER=ansible
> SUDO_UID=30001
> USERNAME=root
> MAIL=/var/mail/ansible
> PATH=/usr/bin:/bin
> PWD=/users/ansible
> LANG=C
> HOME=/root
> SUDO_COMMAND=/bin/bash -c echo
> SUDO-SUCCESS-gkqnfqfgysvzciwpzfzhjksuidabfmha; LANG=C LC_CTYPE=C
> /usr/bin/python
> /users/ansible/.ansible/tmp/ansible-tmp-1432099297.2-178454781677599/command;
> rm -rf
> /users/ansible/.ansible/tmp/ansible-tmp-1432099297.2-178454781677599/
> >/dev/null 2>&1
> SHLVL=2
> LOGNAME=root
> LC_CTYPE=C
> SUDO_GID=30001
> _=/usr/bin/env
> root
> [output omitted]
> ....
> alias sudo="sudo -i"
>
>
> So sudo uses now /bin/bash but it ignors ~/.bashrc alias. Why ? What am I
> missing ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f193e263-deb0-468c-a2c8-e8cf9f41e1b3%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f193e263-deb0-468c-a2c8-e8cf9f41e1b3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFUV_d5oVBHAxbaEFX7OtQvCk4eDE4fHxU5gBz18iDC65Sx1Jw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to