How to Install and Configure ‘Ansible’ on CentOS 7
- Category : Linux Helpline (Easy Guide)
- Posted on : Feb 06, 2019
- Views : 1,821
- By : Marcus J.
Ansible is a tool that used to manage various nodes from an ansible installed Controlling Machine using SSH Protocol. It makes every system administrative tasks more easy.
Ansible System (Controlling Machine):-
IP: 10.0.0.209
Nodes IP:-
10.0.0.206
10.0.0.207
Lets start–
Step 1:-
Ensure that the repository is added in the Controlling Machine or you may need to install it.
Ensure that the repository is added in the Controlling Machine or you may need to install it.
# yum install epel-release -y
Step 2:-
1. Install Ansible using yum in Controlling Machine.
# yum install ansible
2. Check the version of the installed Ansible
# ansible --version
Step 3:-
Setup your Controlling Machine to connect node using SSH protocol.
1. Create ssh key to access node systems.
# ssh-keygen
2. Copy the key to the node systems.
# ssh-copy-id root@10.0.0.206
# ssh-copy-id root@10.0.0.207
Step 4:–
Add ips of node systems into the Inventory of Ansible by editing /etc/ansible/hosts .
# vim /etc/ansible/hosts
[ansi-test]
10.0.0.206
10.0.0.207
Note: Here both ip can call using the name “ansi-test”.
Step 5:-
Test Ansible in the Controlling Machine by using below commands.
1. First of all test the Controlling Machine have ping with node system using ansible commands.
# ansible -m ping all
10.0.0.206 | SUCCESS => {
"changed": false,
"ping": "pong"
}
10.0.0.207 | SUCCESS => {
"changed": false,
"ping": "pong"
}
2. Execute any command in Controlling Machine.
# ansible -m command -a "df -h" ansi-test
10.0.0.206 | SUCCESS | rc=0 >>
Filesystem Size Used Avail Use% Mounted on
default/containers/test1 437G 3.4G 433G 1% /
none 492K 0 492K 0% /dev
udev 3.8G 0 3.8G 0% /dev/tty
tmpfs 100K 0 100K 0% /dev/lxd
tmpfs 100K 0 100K 0% /dev/.lxd-mounts
tmpfs 3.9G 120K 3.9G 1% /dev/shm
tmpfs 3.9G 17M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 784M 0 784M 0% /run/user/0
10.0.0.207 | SUCCESS | rc=0 >>
Filesystem Size Used Avail Use% Mounted on
default/containers/test2 436G 2.6G 433G 1% /
none 492K 0 492K 0% /dev
udev 3.8G 0 3.8G 0% /dev/tty
tmpfs 100K 0 100K 0% /dev/lxd
tmpfs 100K 0 100K 0% /dev/.lxd-mounts
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 17M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 784M 0 784M 0% /run/user/0
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu