Ansible

July 13, 2017 | Linux Provisioning Python

We use Ansible to configure our Ceph storage cluster Pulpos. While there are many popular configuration management systems available for Linux systems, such as Chef and Puppet, Ansible is a great alternative to these options because it has a much smaller overhead. Ansible does not require any additional software to be installed on the client computers. It communicates over normal SSH channels in order to retrieve information from remote machines, issue commands, and copy files (Ref: How to Install and Configure Ansible on CentOS 7).

Installing Ansible

Ansible package is available from the EPEL repository. To install Ansible on the admin node pulpos-admin:

[root@pulpo-admin ~]# yum -y install ansible

Configuring Ansible hosts

Create a simple Ansible hosts file /etc/ansible/hosts that contains all the nodes in the Pulpos cluster:

## Pulpos
[dtn]
pulpo-dtn.local

[mons]
pulpo-mon01.local
pulpo-mds01.local
pulpo-admin.local

[pulpo:children]
dtn
mons

[osds]
pulpo-osd[01:03].local

Testing Ansible

Note: Ansible looks for an ansible.cfg file in the following places, in this order:

  • File specified by the ANSIBLE_CONFIG environment variable
  • ./ansible.cfg (ansible.cfg in the current directory)
  • ~/.ansible.cfg (.ansible.cfg in your home directory)
  • /etc/ansible/ansible.cfg

Let’s perform a simple ping test to all the nodes:

[root@pulpo-admin ~]# ansible -v -m ping all
[root@pulpo-admin ~]# ansible -v -m ping all
Using /etc/ansible/ansible.cfg as config file
pulpo-osd01.local | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
pulpo-mon01.local | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
pulpo-mds01.local | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
pulpo-dtn.local | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
pulpo-admin.local | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
pulpo-osd02.local | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
pulpo-osd03.local | SUCCESS => {
    "changed": false,
    "ping": "pong"
}