Ansible
Ansible and Basic Commands
Ansible is an open-source and Infrastructure Management Tool.
The Ansible file is in YAML format.
Ansible is Agentless works with SSH Protocol.
Ansible is written and uses Python
Ansible has many modules to perform various operations without any programming knowledge.
Ansible Configuration file:
PATH: /etc/ansible/ansible.cfg
remote_tmp = /commlocation (change to common location to avoid permissions issue)
forks = 50 (Adjust to number of instances to connect parallelly )
Default hosts file Path: /etc/ansible/hosts
[TEST1]
server1
server2
[TEST2]
server3
server4
Command Usage:
Ansible to use default host file
$ansible all -m ping -o (run on all the hosts in the hosts file)
$ansible TEST1 -m ping -o (run on nodes under TEST1 group)
to use a custom host file create a file and pass an argument with -i as below
4cat hostfile.ini
[NODE1]
testserver1
testserver2
[NODE2]
testserver3
testserver4
$ansible NODE1 -i hostfile -m ping -o (run only on nodes under NODE1 group)
$ansible all -i hostfile -m ping -o -l testserver1 (runs only on testserver1 server in the file)
Comments
Post a Comment