# \[become: yes\] doesn't work. Failed to run playbook on AWS EC2 Ubuntu instance

**URL:** <https://forum.ansible.com/t/become-yes-doesnt-work-failed-to-run-playbook-on-aws-ec2-ubuntu-instance/26892>\
**Category:** Ansible Project\
**Tags:** ubuntu, aws\
**Created:** [March 3, 2018, 9:26pm UTC](https://forum.ansible.com/t/become-yes-doesnt-work-failed-to-run-playbook-on-aws-ec2-ubuntu-instance/26892 "2018-03-03T21:26:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viktor\_Chernov](https://avatars.discourse-cdn.com/v4/letter/v/65b543/32.png) [@Viktor\_Chernov](https://forum.ansible.com/u/Viktor_Chernov)\
**Post date:** [March 3, 2018, 9:26pm UTC](https://forum.ansible.com/t/become-yes-doesnt-work-failed-to-run-playbook-on-aws-ec2-ubuntu-instance/26892/1 "2018-03-03T21:26:21Z")

</div>

`dexter@dexter-X55A /opt/SSH $ ansible --version ansible 2.4.3.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/dexter/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609]`

`  
├── ansible.cfg

├── inventory.txt  
├── main.retry  
├── main.yml  
├── roles  
│ └── apache-tomcat  
│ ├── defaults  
│ │ └── main.yml  
│ ├── handlers  
│ │ └── main.yml  
│ ├── tasks  
│ │ └── main.yml  
│ └── templates  
│ ├── server.xml.j2  
│ └── tomcat.service.j2  
└── variables.yml  
`

main.yml

`

- hosts: all  
become: yes  
vars\_files:
- variables.yml  
roles:
- role: apache-tomcat  
`  
tasks/main.yaml

`

- name: install packages - apache2, mysql, authbind, java  
apt: name={{ item }} update\_cache=yes state=present  
with\_items:
- “{{package\_list}}”  
`

`  
package\_list:

- apache2
- mysql-server
- default-jdk
- authbind  
`

When i run playbook its show next fail  
`amazon-ebs: failed: [default] (item=[u'apache2', u'mysql-server', u'default-jdk', u'authbind']) => {"changed": false, "cmd": "apt-get update", "item": ["apache2", "mysql-server", "default-jdk", "authbind"], "msg": "W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)\nE: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)", "rc": 100, "stderr": "W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)\nE: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)\nE: Unable to lock directory /var/lib/apt/lists/\nW: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)\nW: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)\n", "stderr_lines": ["W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)", "E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)", "E: Unable to lock directory /var/lib/apt/lists/", "W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)", "W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)"], "stdout": "Reading package lists...\n", "stdout_lines": ["Reading package lists..."]} amazon-ebs: to retry, use: --limit @/opt/terraform/apache-tomcat-automation/2- Create AMI/playbook/main.retry`

Any chance to run this playbook via sudo on remote machine?

---

<div class="post-metadata">

**Author:** ![Viktor\_Chernov](https://avatars.discourse-cdn.com/v4/letter/v/65b543/32.png) [@Viktor\_Chernov](https://forum.ansible.com/u/Viktor_Chernov)\
**Post date:** [March 4, 2018, 9:25am UTC](https://forum.ansible.com/t/become-yes-doesnt-work-failed-to-run-playbook-on-aws-ec2-ubuntu-instance/26892/2 "2018-03-04T09:25:51Z")

</div>

UPDATE!

Finally i solved my problem. Ancible home directory was chown to root only. So i managed it to local user and made executable chomn +x ~/.ansible
