Ansible installation Configuration

Source: Internet
Author: User

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

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.