Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Install and use automated tools Ansible in CentOS 7     - Installation and use of Linux Sniffer tool Tcpdump (Linux)

- GNU / Linux enable Intel Rapid Start (Linux)

- Adding SSH to Github (Linux)

- MongoDB Learning the notes (Database)

- MD5 and simple to use (Linux)

- MySQL query performance comparison of a single truth (Database)

- Linux VMware virtual machine after the cloning of the card can not start to solve (Linux)

- 11.2.04 Oracle RAC directory crfclust.bdb file is too large, Bug 20186278 (Database)

- Print Linux system error codes (Linux)

- Emacs install clojure development environment (Linux)

- Android Service service applications and the phone SMS Listener Listener (Programming)

- Linux systems for entry-learning - Install Go language in Linux (Linux)

- Installation and Configuration Tomcat environment CentOS 6.6 (Server)

- Ubuntu Server security risk checks (Linux)

- Briefly explain the invasion of the four-level denial of service attack DoS Linux server (Linux)

- Growth since Oracle set the table space (Database)

- Install apr support for Tomcat on Linux (Server)

- Cooling solutions Ubuntu system (Linux)

- RM Environment Database RMAN Backup Strategy Formulation (Database)

- Partition contrast manifestations under Windows and Linux (Linux)

 
         
  Install and use automated tools Ansible in CentOS 7
     
  Add Date : 2018-11-21      
         
         
         
  Ansible is a Unix-like system for the development of free and open source configuration and automation tools. It is written in Python, like Chef and Puppet, but there is a distinct advantage and we do not need to install any client in the node. It uses SSH and nodes to communicate.

This blog entry we will install and configure on a CentOS 7 Ansible, and try to manage two nodes.

Ansible server - ansible.linuxtechi.com (192.168.1.15)

Node - 192.168.1.9, 192.168.1.10

Step 1: Set EPEL repository

Ansible warehouse default yum repository is not, so we need to use the following command to enable epel warehouse.

[Root @ ansible ~] # rpm -iUvh http://dl.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
 

Step 2: Use yum install Ansible

[Root @ ansible ~] #yum install ansible
After the installation is complete, check ansible Version:

[Root @ ansible ~] # ansible --version

ansible-version


Step 3: Set SSH keys for authentication node

Generate key Ansible server and copy the public key to the node.

root @ ansible ~] # ssh-keygen

ssh-keygen

Use ssh-copy-id command to copy the public key to Ansible node.

ssh-copy-id-command


STEP 4: Ansible defined node list

File / etc / ansible / hosts Ansible maintains a list of servers.

[Root @ ansible ~] # vi / etc / ansible / hosts
[Test-servers]
192.168.1.9
192.168.1.10
Save and exit the file.

Hosts file examples below

nsible-host

Step five: Try to run the server command Ansible

Use ping to check connectivity 'test-servers' or ansible node.

[Root @ ansible ~] # ansible -m ping'test-servers'


ansible-ping

Execute shell commands

Run time check Ansible node (uptime): Example 1

[Root @ ansible ~] # ansible -m command -a "uptime" 'test-servers'

ansible-uptime

Kernel version check node: Example 2

[Root @ ansible ~] # ansible -m command -a "uname -r" 'test-servers'

kernel-version-ansible

Example 3: to increase the user node

[Root @ ansible ~] # ansible -m command -a "useradd mark" 'test-servers'
[Root @ ansible ~] # ansible -m command -a "grep mark / etc / passwd" 'test-servers'

useradd-ansible

Example 4: redirect the output to a file

[Root @ ansible ~] # ansible -m command -a "df -Th" 'test-servers'> / tmp / command-output.txt

redirecting-output-ansible
     
         
         
         
  More:      
 
- Use rfkill soft-switching and Bluetooth wireless capabilities in Linux (Linux)
- Install Web-based monitoring tool: Linux-Dash (Server)
- Boot automatically remove Linux operating history records (Linux)
- MySQL full-index scan bug (Database)
- Hadoop 0.23 compile common errors (Server)
- See how --nand flash timing diagram of a read operation Comments (Programming)
- Process safety monitoring and protection under the Linux operating system (Linux)
- Ubuntu way of decompressing files (Linux)
- Construction CA certificate using OpenSSL command line (Server)
- Install FFmpeg compiling from source in Mac OS X environment (Linux)
- MySQL query optimization: profile function (Database)
- Using Vagrant to build multi-platform environment (Server)
- How to set the default Fedora from the command line (Linux)
- The need to avoid a gap of InnoDB lock (Database)
- C ++ 11 feature: auto keyword (Programming)
- Ubuntu 14.04.02 LTS startup items erroneous writing / dev / sda1 (win 7 loader) Repair (Linux)
- Commonly used Linux system camouflage method (Linux)
- Linux / Centos anti CC attack script (Linux)
- iSCSI + multipath achieve DM multipath storage (Server)
- Protection Docker container Notice (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.