2018-02-27 Install Ansible

Overview

With the completion of the operating system installation, I can now proceed with the installation of Ansible.

References

Procedure

Followed the procedure in Latest Releases Via Apt (Ubuntu).

Resynchronize Package Index Files

The package index files were resynchronised with their sources as follows:

sudo apt-get -y update

The output was:

Get:1 http://au.archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://au.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:4 http://au.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:5 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1,201 kB]
Get:6 http://au.archive.ubuntu.com/ubuntu xenial/main i386 Packages [1,196 kB]
Get:7 http://au.archive.ubuntu.com/ubuntu xenial/main Translation-en_AU [420 kB]
Get:8 http://au.archive.ubuntu.com/ubuntu xenial/main Translation-en [568 kB]
Get:9 http://au.archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [8,344 B]
Get:10 http://au.archive.ubuntu.com/ubuntu xenial/restricted i386 Packages [8,684 B]
Get:11 http://au.archive.ubuntu.com/ubuntu xenial/restricted Translation-en_AU [2,012 B]
Get:12 http://au.archive.ubuntu.com/ubuntu xenial/restricted Translation-en [2,908 B]
Get:13 http://au.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,532 kB]
Get:14 http://au.archive.ubuntu.com/ubuntu xenial/universe i386 Packages [7,512 kB]
Get:15 http://au.archive.ubuntu.com/ubuntu xenial/universe Translation-en_AU [3,039 kB]
Get:16 http://au.archive.ubuntu.com/ubuntu xenial/universe Translation-en [4,354 kB]
Get:17 http://au.archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]
Get:18 http://au.archive.ubuntu.com/ubuntu xenial/multiverse i386 Packages [140 kB]
Get:19 http://au.archive.ubuntu.com/ubuntu xenial/multiverse Translation-en_AU [67.7 kB]
Get:20 http://au.archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:21 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [736 kB]
Get:22 http://au.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [682 kB]
Get:23 http://au.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [305 kB]
Get:24 http://au.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [7,560 B]
Get:25 http://au.archive.ubuntu.com/ubuntu xenial-updates/restricted i386 Packages [7,524 B]
Get:26 http://au.archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,272 B]
Get:27 http://au.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [592 kB]
Get:28 http://au.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [547 kB]
Get:29 http://au.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [239 kB]
Get:30 http://au.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.2 kB]
Get:31 http://au.archive.ubuntu.com/ubuntu xenial-updates/multiverse i386 Packages [15.3 kB]
Get:32 http://au.archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8,052 B]
Get:33 http://au.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4,836 B]
Get:34 http://au.archive.ubuntu.com/ubuntu xenial-backports/main i386 Packages [4,840 B]
Get:35 http://au.archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [3,220 B]
Get:36 http://au.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6,628 B]
Get:37 http://au.archive.ubuntu.com/ubuntu xenial-backports/universe i386 Packages [6,620 B]
Get:38 http://au.archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [3,768 B]
Fetched 29.9 MB in 35s (847 kB/s)
Reading package lists... Done

Install software-properties-common Package

The package to manage the repositories that you install software from (common) is called software-properties-common. It was installed as follows:

sudo apt-get -y install software-properties-common

The output was:

Reading package lists... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.96.20.7).
0 upgraded, 0 newly installed, 0 to remove and 134 not upgraded.

Install software-properties-common Package

Added the ansible package repository to the list of package sources as follows:

sudo apt-add-repository -y ppa:ansible/ansible

The output was:

gpg: keyring `/tmp/tmppk95hlzm/secring.gpg' created
gpg: keyring `/tmp/tmppk95hlzm/pubring.gpg' created
gpg: requesting key 7BB9C367 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmppk95hlzm/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)
OK

Resynchronize Package Index Files

The package index files were resynchronised with their sources as follows:

sudo apt-get -y update

The output was:

Hit:1 http://au.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://au.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 http://au.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Get:5 http://ppa.launchpad.net/ansible/ansible/ubuntu xenial InRelease [18.0 kB]
Get:6 http://ppa.launchpad.net/ansible/ansible/ubuntu xenial/main amd64 Packages [540 B]
Get:7 http://ppa.launchpad.net/ansible/ansible/ubuntu xenial/main i386 Packages [540 B]
Get:8 http://ppa.launchpad.net/ansible/ansible/ubuntu xenial/main Translation-en [344 B]
Fetched 19.5 kB in 3s (6,373 B/s)
Reading package lists... Done

Install Ansible

Ansible was installed as follows:

sudo apt-get -y install ansible

The output was:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libyaml-0-2 python python-cffi-backend python-crypto python-cryptography python-ecdsa python-enum34 python-httplib2 python-idna
  python-ipaddress python-jinja2 python-markupsafe python-minimal python-paramiko python-pkg-resources python-pyasn1 python-setuptools python-six python-yaml python2.7 python2.7-minimal sshpass
Suggested packages:
  python-doc python-tk python-crypto-dbg python-crypto-doc python-cryptography-doc python-cryptography-vectors python-enum34-doc python-jinja2-doc doc-base python-setuptools-doc python2.7-doc binutils
  binfmt-support
The following NEW packages will be installed:
  ansible libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libyaml-0-2 python python-cffi-backend python-crypto python-cryptography python-ecdsa python-enum34 python-httplib2 python-idna
  python-ipaddress python-jinja2 python-markupsafe python-minimal python-paramiko python-pkg-resources python-pyasn1 python-setuptools python-six python-yaml python2.7 python2.7-minimal sshpass
0 upgraded, 26 newly installed, 0 to remove and 134 not upgraded.
Need to get 7,955 kB of archives.
After this operation, 46.4 MB of additional disk space will be used.
Get:1 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 libyaml-0-2 amd64 0.1.6-3 [47.6 kB]
Get:2 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [340 kB]
Get:3 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [1,261 kB]
Get:4 http://ppa.launchpad.net/ansible/ansible/ubuntu xenial/main amd64 ansible all 2.4.3.0-1ppa~xenial [2,690 kB]
Get:5 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-minimal amd64 2.7.12-1~16.04 [28.1 kB]
Get:6 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-stdlib amd64 2.7.12-1ubuntu0~16.04.3 [1,880 kB]
Get:7 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7 amd64 2.7.12-1ubuntu0~16.04.3 [224 kB]
Get:8 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython-stdlib amd64 2.7.12-1~16.04 [7,768 B]
Get:9 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python amd64 2.7.12-1~16.04 [137 kB]
Get:10 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-markupsafe amd64 0.23-2build2 [15.5 kB]
Get:11 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-jinja2 all 2.8-1 [109 kB]
Get:12 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-yaml amd64 3.11-3build1 [105 kB]
Get:13 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-crypto amd64 2.6.1-6ubuntu0.16.04.2 [246 kB]
Get:14 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-six all 1.10.0-3 [10.9 kB]
Get:15 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-ecdsa all 0.13-2 [34.0 kB]
Get:16 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-paramiko all 1.16.0-1 [109 kB]
Get:17 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-httplib2 all 0.9.1+dfsg-1 [34.2 kB]
Get:18 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-pkg-resources all 20.7.0-1 [108 kB]
Get:19 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-setuptools all 20.7.0-1 [169 kB]
Get:20 http://au.archive.ubuntu.com/ubuntu xenial/universe amd64 sshpass amd64 1.05-1 [10.5 kB]
Get:21 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-cffi-backend amd64 1.5.2-1ubuntu1 [58.1 kB]
Get:22 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-enum34 all 1.1.2-1 [35.8 kB]
Get:23 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-idna all 2.0-3 [35.1 kB]
Get:24 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-ipaddress all 1.0.16-1 [18.0 kB]
Get:25 http://au.archive.ubuntu.com/ubuntu xenial/main amd64 python-pyasn1 all 0.1.9-1 [45.1 kB]
Get:26 http://au.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-cryptography amd64 1.2.3-1ubuntu0.1 [199 kB]
Fetched 7,955 kB in 16s (480 kB/s)
Selecting previously unselected package libyaml-0-2:amd64.
(Reading database ... 59093 files and directories currently installed.)
Preparing to unpack .../libyaml-0-2_0.1.6-3_amd64.deb ...
Unpacking libyaml-0-2:amd64 (0.1.6-3) ...
Selecting previously unselected package libpython2.7-minimal:amd64.
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package python.
(Reading database ... 59845 files and directories currently installed.)
Preparing to unpack .../python_2.7.12-1~16.04_amd64.deb ...
Unpacking python (2.7.12-1~16.04) ...
Selecting previously unselected package python-markupsafe.
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-crypto.
Preparing to unpack .../python-crypto_2.6.1-6ubuntu0.16.04.2_amd64.deb ...
Unpacking python-crypto (2.6.1-6ubuntu0.16.04.2) ...
Selecting previously unselected package python-six.
Preparing to unpack .../python-six_1.10.0-3_all.deb ...
Unpacking python-six (1.10.0-3) ...
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 python-pkg-resources.
Preparing to unpack .../python-pkg-resources_20.7.0-1_all.deb ...
Unpacking python-pkg-resources (20.7.0-1) ...
Selecting previously unselected package python-setuptools.
Preparing to unpack .../python-setuptools_20.7.0-1_all.deb ...
Unpacking python-setuptools (20.7.0-1) ...
Selecting previously unselected package sshpass.
Preparing to unpack .../sshpass_1.05-1_amd64.deb ...
Unpacking sshpass (1.05-1) ...
Selecting previously unselected package python-cffi-backend.
Preparing to unpack .../python-cffi-backend_1.5.2-1ubuntu1_amd64.deb ...
Unpacking python-cffi-backend (1.5.2-1ubuntu1) ...
Selecting previously unselected package python-enum34.
Preparing to unpack .../python-enum34_1.1.2-1_all.deb ...
Unpacking python-enum34 (1.1.2-1) ...
Selecting previously unselected package python-idna.
Preparing to unpack .../python-idna_2.0-3_all.deb ...
Unpacking python-idna (2.0-3) ...
Selecting previously unselected package python-ipaddress.
Preparing to unpack .../python-ipaddress_1.0.16-1_all.deb ...
Unpacking python-ipaddress (1.0.16-1) ...
Selecting previously unselected package python-pyasn1.
Preparing to unpack .../python-pyasn1_0.1.9-1_all.deb ...
Unpacking python-pyasn1 (0.1.9-1) ...
Selecting previously unselected package python-cryptography.
Preparing to unpack .../python-cryptography_1.2.3-1ubuntu0.1_amd64.deb ...
Unpacking python-cryptography (1.2.3-1ubuntu0.1) ...
Selecting previously unselected package ansible.
Preparing to unpack .../ansible_2.4.3.0-1ppa~xenial_all.deb ...
Unpacking ansible (2.4.3.0-1ppa~xenial) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libyaml-0-2:amd64 (0.1.6-3) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Setting up libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up python (2.7.12-1~16.04) ...
Setting up python-markupsafe (0.23-2build2) ...
Setting up python-jinja2 (2.8-1) ...
Setting up python-yaml (3.11-3build1) ...
Setting up python-crypto (2.6.1-6ubuntu0.16.04.2) ...
Setting up python-six (1.10.0-3) ...
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 python-pkg-resources (20.7.0-1) ...
Setting up python-setuptools (20.7.0-1) ...
Setting up sshpass (1.05-1) ...
Setting up python-cffi-backend (1.5.2-1ubuntu1) ...
Setting up python-enum34 (1.1.2-1) ...
Setting up python-idna (2.0-3) ...
Setting up python-ipaddress (1.0.16-1) ...
Setting up python-pyasn1 (0.1.9-1) ...
Setting up python-cryptography (1.2.3-1ubuntu0.1) ...
Setting up ansible (2.4.3.0-1ppa~xenial) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...

Establish SSH Connectivity

After Ansible was successfully installed, SSH equivalency was established and Ansible was tested.

Establish SSH Credentials on AUBURN

The following command was used to establish SSH credentials on AUBURN:

ssh-keygen

The output was:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/douglas/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/douglas/.ssh/id_rsa.
Your public key has been saved in /home/douglas/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:shjEH2qkzF+G4j+eNxAlULEyDUikdRuVVNH+HU10AmA douglas@auburn.yaocm.id.au
The key's randomart image is:
+---[RSA 2048]----+
|o++o=+ooooE.....o|
|o. =.+o  ..    .o|
|. o Bo.  .     o |
| o *.+ .  .   . .|
|  = =.= S  . . . |
| . +.= o    . .  |
|  . o..          |
|   ...o          |
|   .+o .         |
+----[SHA256]-----+

Propagate SSH Credentials to PENRITH

The following command was used to copy SSH credentials on AUBURN to PENRITH:

ssh-copy-id penrith.yaocm.id.au

The output was:

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/douglas/.ssh/id_rsa.pub"
The authenticity of host 'penrith.yaocm.id.au (192.168.1.249)' can't be established.
ECDSA key fingerprint is SHA256:bjjW/BAGqhn1meKlFTMV2JKsDLfHv3Mm6YbKGVmhfsI.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
douglas@penrith.yaocm.id.au's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'penrith.yaocm.id.au'"
and check to make sure that only the key(s) you wanted were added.

Propagate SSH Credentials to PENRITH

The following command was used to copy SSH credentials from AUBURN to PENRITH:

ssh penrith.yaocm.id.au

The output was:

Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-83-generic i686)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 packages can be updated.
0 updates are security updates.

Last login: Thu Feb  1 21:26:41 2018 from 192.168.1.140
douglas@penrith:~$ 

Testing

Followed the procedure in Your first commands.

Establish Hosts Inventory

On AUBURN, the file /etc/ansible/hosts was set to contain the following:

# Client machines

[clients]
penrith.yaocm.id.au

# Oracle RAC Nodes

[oracle_rac]
redfern1.yaocm.id.au
redfern2.yaocm.id.au

Do PING Test

To test Ansible connectivity to the hosts, the following command was used:

ansible all -m ping

The output was:

redfern1.yaocm.id.au | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
penrith.yaocm.id.au | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
redfern2.yaocm.id.au | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: connect to host redfern2.yaocm.id.au port 22: No route to host\r\n", 
    "unreachable": true
}