Background
Recently received a demand for daily inspection of the business equipment, and export reports, but the thought of equipment has N, a daily patrol such repetitive work is too much, so decided to write a script to take care of this matter.
first, the first issue to be addressed is the batch server execution command.
Previously tried to use the pssh to execute scripts on the batch server, limited, the effect is good, you are interested can try, this time in order to keep up with the pace of the Internet company, intends to use Ansible server for batch control.
As for Ansible manual introduction can Baidu, of course, the premise of using Ansible is that you are controlled by the server Python version 2.4 or more, the version of the control machine is more than 2.6.
Installation of Ansible
Install Ez_setup and execute the install command
wget -Q http://peak.telecommunity.com/dist/ez_setup.pypython ez_setup.py
Esay_install ansible
Next, you need to configure the host file for the next ansible as a test. Create a ansible directory under/etc.
mkdir /etc/ansiblevi /etc/ansible/hosts# hosts[local]127.0. 0.1
Then run the next command to see if it executed successfully.
Ansible "who"
If you find that the password authentication method is wrong, set up a secret login.
Ssh-keygen ssh-copy-ID -I. ~/. SSH [email protected] 127.0. 0.1
Test the command again to find that the operation was successful.
At this point, the problem is resolved.
Linux server routine patrol and generate report (i)