absible is a IT automation and DevOps launched in 2013 span>The software, acquired by redhat in 2015, is based on python research and development. It combines the advantages of many old operation and maintenance tools to achieve batch operating system configuration, batch program deployment, batch running commands and other functions
Ansible can be realized :
– Automated deployment APP
– Automated management configuration items
– Automated continuous delivery
– Automation (AWS ) Cloud service management
Ansible advantages:
– Only need ssh and python to use
– No client
–Ansible is powerful and rich in modules
– Easy to get started, low barriers
– Based on python development, it is easier to do secondary development
p>
– There are more companies and active communities
Ansible features:
Modular design, calling specific modules to complete specific tasks
based on python language implementation
– paramiko
– PyYAML (semi-structured language) – PyYAML (semi-structured language)
2 >
Its module supports standard output roots such as JSON, and can be rewritten in any language
easy deployment
work in master-slave mode
p>
supports custom modules
supports playbook
easy to use
supports multi-tier deployment
supports
Work flow:
Software dependencies
requires python2.6 or python2.7
For managed hosts< /p>
– Ansible mode manages the machine through the ssh protocol
– The managed host needs to open the ssh service and allow the ansible host to also log in on the node
– If selinux is enabled on the managed node, libselinux-python needs to be installed
Install ansible:
p>
ansible source download
– git clone git://github.com/ansible/ansible.git
– yum install python-devel
– python setup.py buils
– python setup.py install
– pip install
– pip ible /p>
yum extension is easy to install and automatically resolve dependencies
– http://mirror.centos.org/…/…/extras/
– yum -y install ansible
Verify after installation
ansible –version
ansible command basis
—M specifies the module path
—a module parameter
– -k Use interactive login password
– -e Define variables
—v detailed information
—m Use the module, the command module is used by default
List the requirements Host executing:
ansible all –list-hos ts
Check hosts in batches
ansible all -m ping
Execute commands in batches
ansible all -m command -a “id” -k
ansible-doc
–The manual of the module is equivalent to the man of the shell. Very important, very important
– ansible -doc -l List all modules
ping module
– Test network connectivity
– Note: Test ssh connectivity
ansible hostname -m ping
To put it bluntly, one common command is just one password must not be done before the secret command /p>