Using Ansible Linux Academy

Documentation

man ansible-doc

list all the module
ansible-doc -l

show docoumentation for ec2 module
ansible-doc ec2

test the environment

  • create test user and password
mkdir playbooks
chown test:test playbooks/
su - test
ssh-keygen
ssh-copy-id ipdestination

download and install centos - to verify

yum install epel-release
yum update repolist
yum update
yum install ansible

config file

  • ansible.cfg can be overwritten by command line and inside the playbook
  • selinux can create some problems evaluate to disable in not production environment

python

  • for ansible 1.9 at least python 2.5 but it is convenient use the 2.6 or 2.7 , not use python 3
yum list installed | grep python
whereis python

lesson hosts file

nano /etc/ansible/hosts

[[local]]
localhost

[[apacheweb]]
tox4.mylabserver.com

[[appserver]]
tcox5.mylabserver.com

override host

ansible all --list-hosts
ansible apacheweb -m ping

to use another host file
ansible tcox5 -i hosts ping
Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License