Howto install Ansible on Ubuntu 16 Debian

Howto install Ansible on Ubuntu 16 Debian


1. First, you need to install the PPA repository on the Ansible node:
$ sudo apt-add-repository ppa:ansible/ansible

root@ubuntu:~# sudo apt-add-repository ppa:ansible/ansible
Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.
More info:
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmp0468hn6z/secring.gpg’ created
gpg: keyring `/tmp/tmp0468hn6z/pubring.gpg’ created
gpg: requesting key 7BB9C367 from hkp server
gpg: /tmp/tmp0468hn6z/trustdb.gpg: trustdb created
gpg: key 7BB9C367: public key “Launchpad PPA for Ansible, Inc.” imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
You may be prompted to add the repository; simply hit enter if you are.

2. Now you have the PPA repository installed, you need to update the apt repositories
with the following command:
$ sudo apt-get update
3. You can now install Ansible using the following command:
$ sudo apt-get install ansible

root@ubuntu:~# sudo apt-get install ansible
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
python-ecdsa python-httplib2 python-jinja2 python-markupsafe python-paramiko python-yaml sshpass
Suggested packages:
The following NEW packages will be installed:
ansible python-ecdsa python-httplib2 python-jinja2 python-markupsafe python-paramiko python-yaml sshpass
0 upgraded, 8 newly installed, 0 to remove and 484 not upgraded.
Need to get 1,657 kB of archives.
After this operation, 11.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 xenial/main amd64 python-markupsafe amd64 0.23-2build2 [15.5 kB]
Get:2 xenial/main amd64 ansible all [1,241 kB]
Get:3 xenial/main amd64 python-jinja2 all 2.8-1 [109 kB]
Get:4 xenial/main amd64 python-yaml amd64 3.11-3build1 [105 kB]
Get:5 xenial/main amd64 python-ecdsa all 0.13-2 [34.0 kB]
Get:6 xenial/main amd64 python-paramiko all 1.16.0-1 [109 kB]
Get:7 xenial/main amd64 python-httplib2 all 0.9.1+dfsg-1 [34.2 kB]
Get:8 xenial/universe amd64 sshpass amd64 1.05-1 [10.5 kB]
Fetched 1,657 kB in 3s (432 kB/s)
Selecting previously unselected package python-markupsafe.
(Reading database … 273142 files and directories currently installed.)
Preparing to unpack …/python-markupsafe_0.23-2build2_amd64.deb …
Unpacking python-markupsafe (0.23-2build2) …
Selecting previously unselected package python-jinja2.
Preparing to unpack …/python-jinja2_2.8-1_all.deb …
Unpacking python-jinja2 (2.8-1) …
Selecting previously unselected package python-yaml.
Preparing to unpack …/python-yaml_3.11-3build1_amd64.deb …
Unpacking python-yaml (3.11-3build1) …
Selecting previously unselected package python-ecdsa.
Preparing to unpack …/python-ecdsa_0.13-2_all.deb …
Unpacking python-ecdsa (0.13-2) …
Selecting previously unselected package python-paramiko.
Preparing to unpack …/python-paramiko_1.16.0-1_all.deb …
Unpacking python-paramiko (1.16.0-1) …
Selecting previously unselected package python-httplib2.
Preparing to unpack …/python-httplib2_0.9.1+dfsg-1_all.deb …
Unpacking python-httplib2 (0.9.1+dfsg-1) …
Selecting previously unselected package sshpass.
Preparing to unpack …/sshpass_1.05-1_amd64.deb …
Unpacking sshpass (1.05-1) …
Selecting previously unselected package ansible.
Preparing to unpack …/ansible_2.1.1.0-1ppa~xenial_all.deb …
Unpacking ansible ( …
Processing triggers for man-db (2.7.5-1) …
Setting up python-markupsafe (0.23-2build2) …
Setting up python-jinja2 (2.8-1) …
Setting up python-yaml (3.11-3build1) …
Setting up python-ecdsa (0.13-2) …
Setting up python-paramiko (1.16.0-1) …
Setting up python-httplib2 (0.9.1+dfsg-1) …
Setting up sshpass (1.05-1) …
Setting up ansible ( …

4. You can test if Ansible is installed correctly using the version switch, as shown in the following example:
$ ansible –version

root@ubuntu:~# ansible –version
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

This should return the version of Ansible that you have installed.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>