Getting started with Ansible
Ansible is an open-source automation engine that automates cloud provisioning, configuration management, and application deployment. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates. Once installed on a control node, Ansible, which is an agent-less architecture, connects to a managed node through the default OpenSSH connection type.
Simplicity and ease-of-use are Ansible’s main goals with a strong focus on security and reliability.
Ansible developers believe simplicity is relevant to all sizes of environments, so the design is for busy users of all types: developers, sysadmins, release engineers, IT managers, and everyone in between. Ansible is appropriate for managing all environments, from small setups with a handful of instances to enterprise environments with many thousands of instances.
We already mentioned that Ansible manages machines in an agent-less manner. The question of how to upgrade remote daemons or the problem of not being able to manage systems because daemons are uninstalled is never an issue. OpenSSH is one of the most peer-reviewed open source components thus security exposure is greatly reduced. Ansible is decentralized–it relies on your existing OS credentials to control access to remote machines. If needed, Ansible can easily connect with Kerberos, LDAP, and other centralized authentication management systems.
Ansible Design Principles
- Have a dead simple setup process and a minimal learning curve;
- Manage machines very quickly and in parallel;
- Avoid custom-agents and additional open ports, be agentless by leveraging the existing SSH daemon;
- Describe infrastructure in a language that is both machine and human friendly;
- Focus on security and easy auditability/review/rewriting of content;
- Manage new remote machines instantly, without bootstrapping any software;
- Allow module development in any dynamic language, not just Python;
- Be usable as non-root;
- Be the easiest IT automation system to use, ever.
By default, Ansible manages machines over the SSH protocol. Once installed, Ansible will not add a database which means that there will be no daemons to start or keep running. You can easily install Ansible and manage your remote machines from it. Ansible can be installed on Red Hat, Debian, CentOS, OS X, BSD and more systems via the operating systems package managers, PIP or from source.
Fedora users can install Ansible directly, however, CentOS and RHEL users need to enable the EPEL repo first. It can be done using:
RHEL/CentOS 7 64-Bit #
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm # rpm -ivh epel-release-7-9.noarch.rpm
RHEL/CentOS 6 32-Bit
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm # rpm -ivh epel-release-6-8.noarch.rpm
RHEL/CentOS 6 64-Bit
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -ivh epel-release-6-8.noarch.rpm
After installing EPEL, run:
# yum update # yum install ansible
Before installing Ansible on Ubuntu, PPA needs to be enabled:
# sudo apt-get install software-properties-common # sudo apt-add-repository ppa:ansible/ansible # sudo apt-get update # sudo apt-get install ansible
Users of Debian can leverage the same source as the Ubuntu PPA:
With one of your favorite text editors add the below line to the /etc/apt/sources.list file:
deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
Save and close the file and then run:
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 # sudo apt-get update # sudo apt-get install ansible
Ansible can be installed using PIP as well. The below commands will install some much-needed Python tools, PIP and then Ansible:
# apt-get install python-setuptools # easy_install pip # pip install ansible
By default, Ansible uses OpenSSH for remote communication and has a default inventory file where you can define which servers will be managed. The file in question is: /etc/ansible/hosts
Purely for reference purposes, you can copy the default file so you can check on it later:
# cp /etc/ansible/hosts /etc/ansible/hosts.org
Now you can edit the inventory file according to your needs. More info on Ansible Inventory can be found here.
Now, this is just a glimpse of what Ansible is and offers to users. This is just a get-to-know article that hopefully will spur your interest in Ansible and the wonderful features it offers.
A more detailed info that you’ll most certainly need is the Ansible documentation.
If you use one of our Linux VPS hosting services do not hesitate to ask our expert Linux admins if you need help getting started with Ansible. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons below or simply leave a comment. Thanks.