hidden:Ansible on hpa

From Lsdf
Revision as of 19:50, 19 June 2016 by Jvw (talk | contribs)
Jump to navigationJump to search

Ansible (on github) is a configuration manager that requires no software installation on the target hosts and can run along side existing configuration programs like puppet, cfengine etc... Only ssh access from server to client is required. RedHat has adopted Ansible as its configuration egine.

The Ansible directory on hpa is: /root/Ansible.

The ansible configuration system uses playbooks at the top level. Playbooks contain plays, plays consist of tasks and tasks call modules. The modules are the core of ansible. These are ready made functions that can setup the network, copy files, install software etc. You can find the catalog of modules here. Everything runs strict step by step except handlers. Tasks can trigger handlers. Handlers run at the end, once.

To become familiar with ansible here are a few command examples.

  • Ping a list of hosts

Ping every host listed in the inventory. The inventory is a list with hostnames or ip adresses. Default is 'hosts' but in this example the -i flag is used to tell Ansible what inventory file to use

 [root@hpa Ansible]# ansible -i test.hosts all -m ping
 172.18.95.51 | SUCCESS => {
     "changed": false,
     "ping": "pong"
 }
 172.18.95.50 | UNREACHABLE => {
     "changed": false,
     "msg": "Failed to connect to the host via ssh.",
     "unreachable": true
 }

You see 172.18.95.50 does not respond. This command is nice to check connectivity.

  • 2

The following playbooks are available on hpa

  • update automount files
  • update rsyslog.conf files

Installation log

Add the epel repo to the list of repos, run an update check and install ansible from epel

 # rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epelrelease-7-5.noarch.rpm
 # yum update
 # yum install ansible

On hpa (stock RHL 7) this installed ansible and 12 dependencies most notable a bunch of python packages Ansible normally lives out of /etc. I have changed the location of the ansible files to /root/Ansible using a symlink in /etc/


Updated Ansible on 19.6.2016

  (1/1): ansible-2.1.0.0-1.el7.noarch.rpm                    | 3.4 MB   00:00
  Old: 2.0.2.0-1
  New: 2.1.0.0-1