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?