{"id":21564,"date":"2017-02-24T07:35:05","date_gmt":"2017-02-24T13:35:05","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=21564"},"modified":"2022-06-03T03:42:18","modified_gmt":"2022-06-03T08:42:18","slug":"getting-started-with-ansible","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/getting-started-with-ansible\/","title":{"rendered":"Getting started with Ansible"},"content":{"rendered":"
<\/p>\n
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<\/a> connection type.<\/p>\n Simplicity and ease-of-use are Ansible\u2019s main goals with a strong focus on security and reliability. 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\u2013it 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.<\/p>\n 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.<\/p>\n Fedora users can install Ansible directly, however, CentOS<\/a> and RHEL users need to enable the EPEL repo first. It can be done using:<\/p>\n After installing EPEL, run:<\/p>\n Before installing Ansible on Ubuntu<\/a>, PPA needs to be enabled:<\/p>\n Users of Debian<\/a> can leverage the same source as the Ubuntu PPA:<\/p>\n With one of your favorite text editors add the below line to the \/etc\/apt\/sources.list file:<\/p>\n Save and close the file and then run:<\/p>\n Ansible can be installed using PIP<\/a> as well. The below commands will install some much-needed Python tools, PIP and then Ansible:<\/p>\n 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<\/p>\n Purely for reference purposes, you can copy the default file so you can check on it later:<\/p>\n Now you can edit the inventory file according to your needs. More info on Ansible Inventory can be found here.<\/p>\n 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.<\/p>\n A more detailed info that you’ll most certainly need is the Ansible documentation<\/a>.<\/p>\n
\nAnsible 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.<\/p>\nAnsible Design Principles<\/h2>\n
\n
ANSIBLE INSTALLATION<\/h2>\n
RED HAT\/CENTOS\/FEDORA<\/h3>\n
RHEL\/CentOS 7 64-Bit #<\/h4>\n
# wget http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/epel-release-7-9.noarch.rpm\r\n\r\n# rpm -ivh epel-release-7-9.noarch.rpm<\/pre>\n
RHEL\/CentOS 6 32-Bit<\/h4>\n
# wget http:\/\/download.fedoraproject.org\/pub\/epel\/6\/i386\/epel-release-6-8.noarch.rpm\r\n\r\n# rpm -ivh epel-release-6-8.noarch.rpm<\/pre>\n
RHEL\/CentOS 6 64-Bit<\/h4>\n
# wget http:\/\/download.fedoraproject.org\/pub\/epel\/6\/x86_64\/epel-release-6-8.noarch.rpm\r\n\r\n# rpm -ivh epel-release-6-8.noarch.rpm<\/pre>\n
# yum update\r\n\r\n# yum install ansible<\/pre>\n
UBUNTU<\/h3>\n
# sudo apt-get install software-properties-common\r\n\r\n# sudo apt-add-repository ppa:ansible\/ansible\r\n\r\n# sudo apt-get update\r\n\r\n# sudo apt-get install ansible<\/pre>\n
DEBIAN<\/h3>\n
deb http:\/\/ppa.launchpad.net\/ansible\/ansible\/ubuntu trusty main<\/pre>\n
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367\r\n\r\n# sudo apt-get update\r\n\r\n# sudo apt-get install ansible<\/pre>\n
# apt-get install python-setuptools\r\n\r\n# easy_install pip\r\n\r\n# pip install ansible<\/pre>\n
# cp \/etc\/ansible\/hosts \/etc\/ansible\/hosts.org<\/pre>\n