Manage Node
- System Information
ProductName: Mac OS X
ProductVersion: 10.14.5
BuildVersion: 18F132
- Ansible Verison
ansible 2.8.3
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/Users/nobody/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Python/2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.10 (default, Feb 22 2019, 21:55:15) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]
Remote Node
- System Information
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
Playbook
---
- hosts: test
become: True
roles:
- { role: common }
Roles
# tree roles/common
roles/common
├── README.md
├── defaults
│ └── main.yml
├── files
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── tasks
│ ├── install_packages.yml
│ └── main.yml
├── templates
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
8 directories, 9 files
cat
roles/common/tasks/install_packages.yml
---
- name: Apt Update
apt:
force_apt_get: yes
update_cache: yes
cache_valid_time: 3600
- name: Ensure install software-properties-common
apt:
name: software-properties-common
state: present
force_apt_get: yes
Error Messages
- First error message
[WARNING]: Updating cache and auto-installing missing dependency: python-apt
- Fixed first error
login remote node
$ sudo apt-get isntall -y python-apt
- Second error error
Failed to lock apt for exclusive operation
- Fixed second error
Add parameter to apt task
cache_valid_time: 3600
沒有留言:
張貼留言