Ansible uses Playbooks for express configurations, deployment, and orchestration.
The Playbook format is YAML each and Playbook maps a group of hosts to a set of roles. Each role is represented by calls to Ansible tasks. Ansible does not require an agent on the host system for SSH. As long as Ansible can make an SSH connection to the target device, we should be good. Ansible is primarily used for server & network administration.
There are two versions for Ansibles, free and paid. The paid version is called Ansible Tower which is an enterprise framework for controlling, securing and managing your Ansible automation with a GUI and Restful API.
I'm using Ubuntu 16.04 to install Ansible on my VMWorkstation but you can use any Linux OS.
1 - Installing Ansible
The best way to get Ansible for Ubuntu is to add the project's PPA (personal package archive) to your system.
sudo apt-add-repository ppa:ansible/ansible
Next, we will refresh our system's package index so that it is aware of the packages available in the PPA.
sudo apt-get update
sudo apt-get install ansible
Once it's completed, run the below command to verify the Ansible version
ansible --version
Ansible keeps track of all of the servers that it knows about through a "hosts" file. We need to set up the Ansible Host file.
Open the file with root privileges:
sudo nano /etc/ansible/hosts
[group_name]
variable ansible_ssh_host=server_ip
In this example, we have a server which we are going to control with Ansible. We can access the server from Ansible by typing below command:
ssh root@server_ip
[servers]
HostA ansible_ssh_host=10.10.10.1
hostB ansible_ssh_host=10.10.10.2
hostc ansible_ssh_host=10.10.10.3
If you want to enable colorful terminal in Ubuntu, below are the commands:Edit the file .bashrc in your home directory:
vim .bashrc
Uncomment the line that says ‘force_color_prompt=yes’ and save it. Then type the following:
source ~/.bashrc
Done!
Ansible is a very powerful tool and is going to change the way of automation in future.
I hope this will be helpful for you. This was a simple tutorial and there will be more to come.
No comments:
Post a Comment