Ansible Configuration and Installation
First, installation
1. Install Python
# tar Xvzf python-2.7.8.tgz
# CD Python-2.7.8
#./configure--prefix=/usr/local
# make--jobs= ' grep processor/proc/cpuinfo | Wc-l '
# make instal L
or directly install Yum source yum install python*.
Because Ansible is written in the Python language. So Python support is required.
2, Installation Ansible
RPM-IVH Yum Source
http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Yum Install Ansible
Second, the configuration ansible
Configuration file
(1) ansible.cfg
The file is under/etc/ansible/
The configuration file primarily defines the default paths for some ports and files that are generally not required to be modified. For details, please refer to:
http://ju.outofmemory.cn/entry/144343
(2) master configuration file hosts
The path to the file is/etc/ansible/hosts defined in ansible.cfg.
[webhosts]//can define Group
192.168.2.235 ansible_ssh_user=root ansible_ssh_pass=1234//The password can be defined here, but it is best to build ssh trust best
192.168.2.180 Ansible_ssh_user=root ansible_ssh_pass=1234
192.168.2.141 Ansible_ssh_user=root ansible_ssh_pass=1234
The above several IP addresses belong to Webhosts can manage the webhosts in batch.
Third, testing
Ansible is a powerful command.
Simple test: ansible webhosts-m Ping
Appears as follows:
192.168.2.141 | Success >> {
"Changed": false,
"Ping": "Pong"
}
192.168.2.235 | Success >> {
"Changed": false,
"Ping": "Pong"
}
192.168.2.180 | Success >> {
"Changed": false,
"Ping": "Pong"
}
This indicates that the control side and the controlled side are already connected.
This article from "The Dark before Dawn" blog, declined reprint!
Ansible Installation Configuration