Linux server routine patrol and generate report (i)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.