gvdm
gvdm

Reputation: 3166

"apt" module stops in Ansible

I'm learning Ansible and I'm having a problem with the "apt" module. I wrote the ansible.cfg and the inventory files and I can correctly run

ansible testserver -m ping

Now I'm trying to install NGinx on the target, running

ansible testserver -s -m apt -a name=nginx

but the operation stops. This is the output with the "-vvv" flag

<IP> ESTABLISH CONNECTION FOR USER: user
<IP> REMOTE_MODULE apt name=nginx
<IP> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.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', 'IP', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986 && echo $HOME/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986'"]
<IP> PUT /tmp/tmpWaB4Lf TO /home/user/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986/apt
<IP> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.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', 'IP', '/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=gakusrfbokzukkfpfgbvuseekjyqlllu] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-gakusrfbokzukkfpfgbvuseekjyqlllu; /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986/apt; rm -rf /home/user/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986/ >/dev/null 2>&1\'"\'"\'\'']

Do you have any idea what about the origin of the problem?

Thank you

Upvotes: 1

Views: 256

Answers (1)

Dan
Dan

Reputation: 1986

I notice you concluded the problem was with sudo. Just to let you know, you don't have to have passwordless sudo enabled on the machine you are targeting. You can use the --ask-sudo-pass flag when running your Ansible playbook.

Upvotes: 2

Related Questions