# error when installing apache on ubuntu

**URL:** <https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [June 1, 2017, 6:16pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625 "2017-06-01T18:16:49Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![DOkuwa](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dokuwa/32/1471_2.png) [@DOkuwa](https://forum.ansible.com/u/DOkuwa)\
**Post date:** [June 1, 2017, 6:16pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/1 "2017-06-01T18:16:49Z")

</div>

This is my playbook apache.yml

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [June 1, 2017, 6:27pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/2 "2017-06-01T18:27:49Z")

</div>

–become-method does not imply that ansible should actually “become”

You will also need to add `--become`

---

<div class="post-metadata">

**Author:** ![DOkuwa](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dokuwa/32/1471_2.png) [@DOkuwa](https://forum.ansible.com/u/DOkuwa)\
**Post date:** [June 1, 2017, 6:59pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/3 "2017-06-01T18:59:12Z")

</div>

Matt,

Thanks

I now used this command  
ansible-playbook -u dokuwa1 --ask-pass --become playbook/apache.yml

i get another error message

fatal: [192.168.85.129]: FAILED! =\> {“changed”: false, “failed”: true, “module\_stderr”: “Shared connection to 192.168.85.129 closed.\r\n”, “module\_stdout”: “sudo: a password is required\r\n”, “msg”: “MODULE FAILURE”, “rc”: 1}  
[WARNING]: Could not create retry file ‘/etc/ansible/playbook/apache.retry’.  
[Errno 13] Permission denied: u’/etc/ansible/playbook/apache.retry’

Is there anything i am doing wrong

Daley

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [June 1, 2017, 7:04pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/4 "2017-06-01T19:04:41Z")

</div>

You initially had --become-method=su and --ask-su-pass

You needed to additionally specify --become

So (using the newer param):

ansible-playbook -u dokuwa1 --ask-pass --become-method=su --ask-become-pass --become playbook/apache.yml

---

<div class="post-metadata">

**Author:** ![DOkuwa](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dokuwa/32/1471_2.png) [@DOkuwa](https://forum.ansible.com/u/DOkuwa)\
**Post date:** [June 1, 2017, 7:30pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/5 "2017-06-01T19:30:14Z")

</div>

Hello Matt,

i now got this error message again

PLAY [all] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [192.168.85.129]: FAILED! =\> {“failed”: true, “msg”: "Timeout (12s) waiting for privilege escalation prompt: "}  
[WARNING]: Could not create retry file ‘/etc/ansible/playbook/apache.retry’.  
[Errno 13] Permission denied: u’/etc/ansible/playbook/apache.retry’

thanks

---

<div class="post-metadata">

**Author:** ![Arvind\_Thatikonda](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Arvind\_Thatikonda](https://forum.ansible.com/u/Arvind_Thatikonda)\
**Post date:** [November 26, 2018, 3:13pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/6 "2018-11-26T15:13:54Z")

</div>

Dear Friends,

I am new to ansible, just started to get my hands dirty with the playbooks, I am trying to install apache on ubuntu client machine. I am facing same issue in the email chain.

[DEPRECATION WARNING]: DEFAULT\_SUDO\_USER option, In favor of Ansible Become, which is a generic framework.

See become\_user. , use become instead. This feature will be removed in version 2.8. Deprecation warnings can

be disabled by setting deprecation\_warnings=False in ansible.cfg.

PLAY [client] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

fatal: [x.x.x.x]: FAILED! =\> {“changed”: false, “module\_stderr”: “Shared connection to x.x.x.x closed.\r\n”, “module\_stdout”: “sudo: a password is required\r\n”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}

to retry, use: --limit @/home/ansible/playbooks/apache.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

x.x.x.x : ok=0 changed=0 unreachable=0 failed=1

Can someone please clarify what is the issue?

here is my code :

— # Plyabook Apache install on client

- hosts: client

user: ansible

become: yes

become\_method: sudo

connection: ssh

gather\_facts: yes

tasks:

- name: install apache on client machine

yum:

name: apache2

state: present

update\_cache: yes

---

<div class="post-metadata">

**Author:** ![John\_Foley](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@John\_Foley](https://forum.ansible.com/u/John_Foley)\
**Post date:** [November 26, 2018, 5:20pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/7 "2018-11-26T17:20:56Z")

</div>

First off, it looks like you have a sudo problem. Either you need to configure passwordless sudo on the target marchine, or you need to add a -K to the ansible-playbook command to have it prompt for the become password.

Also, you are using the yum module for what you say is a Ubuntu host. You should be using the apt module.

---

<div class="post-metadata">

**Author:** ![Arvind\_Thatikonda](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Arvind\_Thatikonda](https://forum.ansible.com/u/Arvind_Thatikonda)\
**Post date:** [November 26, 2018, 11:55pm UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/8 "2018-11-26T23:55:16Z")

</div>

Thanks John for your reply  
I did setup passwordless ssh connection to the client.

I added the below line on both ansible server and client in visudo file  
ansible ALL=(ALL) NOPASSWD: ALL

Is that correct?

Thanks for correcting me about the yum statement. I will change.

Where do you want me to use -K to prompt for password in the playbook?

---

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [November 27, 2018, 12:23am UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/9 "2018-11-27T00:23:59Z")

</div>

John might be able to rectify me if I am wrong. You can put it anywhere as long as its present after -K switch or --ask-become-pass.

Always good idea to execute ansible-playbook command to see different options/switches.

Kind Regards,  
Ameya Agashe

---

<div class="post-metadata">

**Author:** ![Arvind\_Thatikonda](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Arvind\_Thatikonda](https://forum.ansible.com/u/Arvind_Thatikonda)\
**Post date:** [November 27, 2018, 12:48am UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/10 "2018-11-27T00:48:06Z")

</div>

thanks Ameya, I used it after ansible-playbook -K , it promoted for Sudo Password , so I entered my ‘ansible’ user password  
but I get same error

DEPRECATION WARNING]: DEFAULT\_SUDO\_USER option, In favor of Ansible Become, which is a generic framework.  
See become\_user. , use become instead. This feature will be removed in version 2.8. Deprecation warnings can  
be disabled by setting deprecation\_warnings=False in ansible.cfg.  
SUDO password:

PLAY [client] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [x.x.x.x]: FAILED! =\> {“changed”: false, “module\_stderr”: “Shared connection to x.x.x.x closed.\r\n”, “module\_stdout”: “\r\nansible is not in the sudoers file. This incident will be reported.\r\n”, “msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”, “rc”: 1}  
to retry, use: --limit @/home/ansible/playbooks/apache.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
x.x.x.x : ok=0 changed=0 unreachable=0 failed=1

I am trying to install apache on client node 10.138.0.7

I have setup ansible user on both server and client

when it promoted for password I entered my ansible user password

I don’t think it is asking for the root password

---

<div class="post-metadata">

**Author:** ![Arvind\_Thatikonda](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Arvind\_Thatikonda](https://forum.ansible.com/u/Arvind_Thatikonda)\
**Post date:** [November 27, 2018, 12:51am UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/11 "2018-11-27T00:51:25Z")

</div>

here is the complete log -vvv debug option :

\<10.138.0.7\> ESTABLISH SSH CONNECTION FOR USER: None

\<10.138.0.7\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/4a2f76bb9f 10.138.0.7 ‘/bin/sh -c ‘"’“‘echo ~ && sleep 0’”’"‘’

\<10.138.0.7\> (0, ‘/home/ansible\n’, ‘’)

\<10.138.0.7\> ESTABLISH SSH CONNECTION FOR USER: None

\<10.138.0.7\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/4a2f76bb9f 10.138.0.7 ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “`echo /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430`” && echo ansible-tmp-1543279730.75-165337335093430=“`echo /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430`” ) && sleep 0’“'”‘’

\<10.138.0.7\> (0, ‘ansible-tmp-1543279730.75-165337335093430=/home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430\n’, ‘’)

Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py

\<10.138.0.7\> PUT /home/ansible/.ansible/tmp/ansible-local-2063N2QcuU/tmpCbzUzB TO /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430/AnsiballZ\_setup.py

\<10.138.0.7\> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/4a2f76bb9f ‘[10.138.0.7]’

\<10.138.0.7\> (0, ‘sftp\> put /home/ansible/.ansible/tmp/ansible-local-2063N2QcuU/tmpCbzUzB /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430/AnsiballZ\_setup.py\n’, ‘’)

\<10.138.0.7\> ESTABLISH SSH CONNECTION FOR USER: None

\<10.138.0.7\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/4a2f76bb9f 10.138.0.7 ‘/bin/sh -c ‘"’“‘chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430/ /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430/AnsiballZ\_setup.py && sleep 0’”’"‘’

\<10.138.0.7\> (0, ‘’, ‘’)

\<10.138.0.7\> ESTABLISH SSH CONNECTION FOR USER: None

\<10.138.0.7\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/4a2f76bb9f -tt 10.138.0.7 ‘/bin/sh -c ‘"’“‘sudo -H -S -p “[sudo via ansible, key=fdpjpnhuuvzahtoagmnqvudarudpmuyd] password: " -u root /bin/sh -c '”’”’“'”‘"’“'”‘“‘echo BECOME-SUCCESS-fdpjpnhuuvzahtoagmnqvudarudpmuyd; /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430/AnsiballZ\_setup.py’”’“'”‘"’“'”‘"’“’ && sleep 0’”‘"’’

\<10.138.0.7\> (1, ‘\r\nansible is not in the sudoers file. This incident will be reported.\r\n’, ‘Shared connection to 10.138.0.7 closed.\r\n’)

\<10.138.0.7\> ESTABLISH SSH CONNECTION FOR USER: None

\<10.138.0.7\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/4a2f76bb9f 10.138.0.7 ‘/bin/sh -c ‘"’“‘rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1543279730.75-165337335093430/ \> /dev/null 2\>&1 && sleep 0’”’"‘’

\<10.138.0.7\> (0, ‘’, ‘’)

fatal: [10.138.0.7]: FAILED! =\> {

“changed”: false,

“module\_stderr”: “Shared connection to 10.138.0.7 closed.\r\n”,

“module\_stdout”: “\r\nansible is not in the sudoers file. This incident will be reported.\r\n”,

“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,

“rc”: 1

}

to retry, use: --limit @/home/ansible/playbooks/apache.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

10.138.0.7 : ok=0 changed=0 unreachable=0 failed=1

---

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [November 27, 2018, 1:01am UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/12 "2018-11-27T01:01:50Z")

</div>

That should be an easy fix. The user “ansible” on the remote machine is not in the sudoers file, fix that and I think you should be fine.

How to update sudoers file:  
[https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos](https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos)

Kindly let me know how you go.

Kind regards  
Ameya Agashe

---

<div class="post-metadata">

**Author:** ![Arvind\_Thatikonda](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Arvind\_Thatikonda](https://forum.ansible.com/u/Arvind_Thatikonda)\
**Post date:** [November 27, 2018, 1:15am UTC](https://forum.ansible.com/t/error-when-installing-apache-on-ubuntu/24625/13 "2018-11-27T01:15:06Z")

</div>

Thanks Ameya, for your quick help. Yes that was the issue for it. I was playing around with sudoers file and forgot to change the ansible1 user to ansible
