Hello
I’m trying to run a playbook that will login as user ansible and then sudo to root to make configurations. I have a sudo entry that will allow root without password. The playbook looks like this:
Try replacing become_user: root with:
become_method: sudo
That may work better.
become_user defaults to root, no need to specify, same with become_method: sudo
can you run with -vvvv and show the output? also what ansible version?
OSs involved?
become_user defaults to root, no need to specify, same with become_method: sudo
can you run with -vvvv and show the output? also what ansible version?
OSs involved?
Thanks for your help, The OS is Oracle Linux 6.7. This is a run with -vvvv and the identical playbook.
[ansible@devansible01 playbooks]$ ansible-playbook -vvvv dave_test.yml
PLAY [10.53.153.32] ***********************************************************
GATHERING FACTS ***************************************************************
<10.53.153.32> ESTABLISH CONNECTION FOR USER: ansible
<10.53.153.32> REMOTE_MODULE setup
<10.53.153.32> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/ansible/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.53.153.32 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1448461765.18-146079134487044 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1448461765.18-146079134487044 && echo $HOME/.ansible/tmp/ansible-tmp-1448461765.18-146079134487044’
<10.53.153.32> PUT /tmp/tmp6GajGq TO /home/ansible/.ansible/tmp/ansible-tmp-1448461765.18-146079134487044/setup
<10.53.153.32> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/ansible/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.53.153.32 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=tegibnqlmaxkmlsnfbhesmbwdtrirnci] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-tegibnqlmaxkmlsnfbhesmbwdtrirnci; LANG=C LC_CTYPE=C /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1448461765.18-146079134487044/setup; rm -rf /home/ansible/.ansible/tmp/ansible-tmp-1448461765.18-146079134487044/ >/dev/null 2>&1’”‘"’’
fatal: [10.53.153.32] => Missing become password
TASK: [create zabbix group] ***************************************************
FATAL: no hosts matched or all hosts have already failed – aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/ansible/dave_test.retry
10.53.153.32 : ok=0 changed=0 unreachable=1 failed=0
Thanks! Dave
become_user defaults to root, no need to specify, same with become_method: sudo
can you run with -vvvv and show the output? also what ansible version?
OSs involved?
Sorry, omiited the ansible version. We’re running 1.9.2
DT