Ansible is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows. It includes its own declarative language to describe system configuration. Ansible was written by Michael DeHaan and acquired by Red Hat in 2015. Ansible is agentless, temporarily connecting remotely via SSH or Windows Remote Management (allowing remote PowerShell execution) to do its tasks.
In other words you can run one command on multiple servers and win time.
# Update server
sudo apt-get update
sudo apt-get upgrade -y
# Install dependences
sudo apt-get install python -y
# Install repository
sudo apt-add-repository ppa:ansible/ansible
# Install ansible
sudo apt install ansible
sudo nano /etc/ansible/hosts
/etc/ansible/hosts
[servers]
server1 ansible_host=10.20.0.2
server2 ansible_host=10.20.0.3
server3 ansible_host=10.20.0.4
[all:vars]
ansible_python_interpreter=/usr/bin/python3
sudo ansible-inventory --list -y
output
all:
children:
servers:
hosts:
server1:
ansible_host: 10.20.0.2
ansible_python_interpreter: /usr/bin/python3
server2:
ansible_host: 10.20.0.3
ansible_python_interpreter: /usr/bin/python3
server3:
ansible_host: 10.20.0.4
ansible_python_interpreter: /usr/bin/python3
ungrouped: {}
sudo ansible all -m ping -u root
output
server1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
server2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
server3 | SUCCESS => {
"changed": false,
"ping": "pong"
}
sudo ansible all -a "df -h" -u root
in conclusion we can say that ansible is a wonderful software for managing multiple Linux servers worldwide, extremely easy and accessible to work
We hope you enjoyed this article. If that is so please rate this page with the stars bellow and subscribe to our YouTube channel.