ObjectiveThe objective is to install Ansible on Ubuntu 18.04 Bionic Beaver Linux.
This guide will provide you with instructions on how to install Ansible on Ubuntu 18.04 from a standard Ubuntu repository, PPA repository and also how to install latest Ansible version by compiling the source code.
Operating System and Software Versions
- Operating System: - Ubuntu 18.04 Bionic Beaver
RequirementsPrivileged access to your Ubuntu System as root or via
sudocommand is required.
DifficultyEASY - MEDIUM
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ - requires given linux commands to be executed as a regular non-privileged user
Install Ansible from Ubuntu RepositoryThe easiest way to install Ansible on Ubuntu system is by using the
aptcommand and the standard Ubuntu package repository. Open up terminal and enter:
$ sudo apt install ansibleWhen successful, check your installed Ansible version:
$ ansible --version ansible 188.8.131.52 config file = /etc/ansible/ansible.cfg configured module search path = Default w/o overrides python version = 2.7.14+ (default, Feb 6 2018, 19:12:18) [GCC 7.3.0]
BLUE SKY STUDIOS are looking for Linux Administrator to maintain and support the Studio's 450+ production Linux workstations, including daily interactions with the Studio’s digital animation artists.
LOCATION: Greenwich, Connecticut, USA
Install Ansible from PPA repositoryThis section will describe a procedure on how to install Ansible from the Ansible's personal repository. Let's start by importing Ansible signing keys:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 Executing: /tmp/apt-key-gpghome.qaCmAryJ6P/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 gpg: key 93C4A3FD7BB9C367: public key "Launchpad PPA for Ansible, Inc." imported gpg: Total number processed: 1 gpg: imported: 1Next, add Ansible PPA repository:
$ sudo apt-add-repository "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main"At this stage we are ready to install Ansible on our Ubuntu system:
$ sudo apt install ansibleOnce installed, check your Ansible version:
$ ansible --version ansible 2.6.1 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/linuxconfig/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
Install Ansible from SourceHere we will install Ansible on Ubuntu 18.04 system directly from the Ansible's git repository. The advantage of this installation is that it will yield the highest Ansible version possible. Alternatively, we are able to choose the Ansible version to fit our environment.
To start with, we need to install required prerequisites. Execute the following linux command to perform the installation of all prerequisites:
$ sudo apt install make git make python-setuptools gcc python-dev libffi-dev libssl-dev python-packagingNext, download Ansible source code using the
$ git clone git://github.com/ansible/ansible.gitNavigate to the
$ cd ansibleThis step is optional as it only allows you to select the desired Ansible version to be installed on your system. The following linux command will list all available Ansible versions:
$ git branch -a
Alternatively, we can only list stable Ansible versions:
$ git branch -a | grep stableTake a note of your desired version and execute
git checkout. For example to set the Ansible version to
$ git checkout stable-2.5All what has left is to perform the compilation followed by the Ansible installation:
$ make $ sudo make installOnce ready, confirm the Ansible installation by retrieving its version:
$ ansible --version ansible 2.5.0rc2 config file = None configured module search path = [u'/home/linuxconfig/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.5.0rc2-py2.7.egg/ansible executable location = /usr/local/bin/ansible python version = 2.7.14+ (default, Feb 6 2018, 19:12:18) [GCC 7.3.0]