There are a few of ways to install ansible. For the rest of these articles I’ll be running Ansible on Centos 7.
Install Ansible using yum
This is done like this:
$ yum install epel-release $ yum install ansible
Then check the version of ansible installed:
$ ansible --version
It is actually recommended to install ansible on all client’s and just the controller. That way the clients ends up installing all the python related dependencies.
However the downside with this approach is that the version of ansible that get’s installed is a few versions behind the latest stable version.
Install Ansible from source
To install a newer version, you can run this script as the root user:
After running the above script, log into the machine as the user, “ansible” and password “vagrant”.
Then check what version of ansible is installed:
[ansible@controller ~]$ ansible --version ansible 2.1.0 (devel c433289a8b) last updated 2016/02/03 19:41:31 (GMT +100) lib/ansible/modules/core: (detached HEAD 93d02189f6) last updated 2016/02/03 19:41:39 (GMT +100) lib/ansible/modules/extras: (detached HEAD fff5ae6994) last updated 2016/02/03 19:41:51 (GMT +100) config file = configured module search path = Default w/o overrides
Set up ansible development environment using vagrant
I created a ansible-vagrant project on github to create your very own ansible vagrant environment. If you are new to ansible, then I recommend this approach. That’s because not only will it install a recent version of ansible, but will also set up passwordless ssh access so that your controller can access both client vms without a password prompt.