2018-03-06 Ansible Playbook for GI Network

Overview

Now that directories and users have been set up through Ansible, it is time to set up the networks for the REDFERN cluster.

My very limited understanding of how NMCLI works prevents me from using Ansible to configure the network.

References

Procedure

Create Playbook

The following text was added to networks.yml:

--- - name: Prepare REDFERN Cluster for Oracle GI 12.1 installation (Networking) hosts: redfern1.yaocm.id.au become: true tasks: - name: Public LAN Interface nmcli: conn_name: eth0 dns4: "192.168.1.252 192.168.1.1" gw4: "192.168.1.1" ip4: "192.168.1.140/24" mtu: 1500 state: present type: ethernet - name: Private LAN Interface nmcli: conn_name: eth1 mtu: 9000 state: present type: ethernet ...

Execute Playbook - First Attempt

I tried to run the playbook as follows:

ansible-playbook --ask-become-pass networks.yml

The error messages were:

SUDO password: PLAY [Prepare REDFERN Cluster for Oracle GI 12.1 installation (Networking)] **** TASK [Gathering Facts] ********************************************************* ok: [redfern1.yaocm.id.au] TASK [Public LAN Interface] **************************************************** fatal: [redfern1.yaocm.id.au]: FAILED! => {"changed": false, "msg": "This module requires NetworkManager glib API"} to retry, use: --limit @/etc/ansible/networks.retry PLAY RECAP ********************************************************************* redfern1.yaocm.id.au : ok=1 changed=0 unreachable=0 failed=1

Amend Playbook

One of the exmaples given in nmcli - Manage Networking had a possible solution.

The playbook, networks.yml. was amended to (changes are in bold):

--- - name: Prepare REDFERN Cluster for Oracle GI 12.1 installation (Networking) hosts: redfern1.yaocm.id.au become: true tasks: - name: install needed network manager libs yum: name: '{{ item }}' state: installed with_items: - NetworkManager-glib - libnm-qt-devel.x86_64 - nm-connection-editor.x86_64 - libsemanage-python - policycoreutils-python - name: Configure Public LAN Interface for REDFERN RAC nmcli: conn_name: eth0 dns4: "192.168.1.252 192.168.1.1" gw4: "192.168.1.1" ip4: "192.168.1.140/24" mtu: 1500 state: present type: ethernet - name: Private LAN Interface nmcli: conn_name: eth1 mtu: 9000 state: present type: ethernet ...

Execute Playbook - Second Attempt

I tried to run the playbook as follows:

ansible-playbook --ask-become-pass networks.yml

The error messages were:

SUDO password: PLAY [Prepare REDFERN Cluster for Oracle GI 12.1 installation (Networking)] **** TASK [Gathering Facts] ********************************************************* ok: [redfern1.yaocm.id.au]TASK [install needed network manager libs] ************************************* failed: [redfern1.yaocm.id.au] (item=[u'NetworkManager-glib', u'libnm-qt-devel.x86_64', u'nm-connection-editor.x86_64', u'libsemanage-python', u'policycoreutils-python']) => {"changed": false, "item": ["NetworkManager-glib", "libnm-qt-devel.x86_64", "nm-connection-editor.x86_64", "libsemanage-python", "policycoreutils-python"], "msg": "No package matching 'libnm-qt-devel.x86_64' found available, installed or updated", "rc": 126, "results": ["No package matching 'libnm-qt-devel.x86_64' found available, installed or updated"]} to retry, use: --limit @/etc/ansible/networks.retry PLAY RECAP ********************************************************************* redfern1.yaocm.id.au : ok=1 changed=0 unreachable=0 failed=1

Investigation

The error message from the second attempt said that package, 'libnm-qt-devel.x86_64', could not be found.

According to Ansible to create NIC bonding, I should install the following packages:

    1. NetworkManager-glib
    2. pygobject2

Update Package List in Playbook

Instead of installing both of these packages, I decided to take one (1) at a time, starting with NetworkManager-glib. The playbook, networks.yml. was amended to :

--- - name: Prepare REDFERN Cluster for Oracle GI 12.1 installation (Networking) hosts: redfern1.yaocm.id.au become: true tasks: - name: install needed network manager libs yum: name: '{{ item }}' state: installed with_items: - NetworkManager-glib - name: Configure Public LAN Interface for REDFERN RAC nmcli: conn_name: eth0 dns4: "192.168.1.252 192.168.1.1" gw4: "192.168.1.1" ip4: "192.168.1.140/24" mtu: 1500 state: present type: ethernet - name: Private LAN Interface nmcli: conn_name: eth1 mtu: 9000 state: present type: ethernet ...

Execute Playbook - Third Attempt

I tried to run the playbook as follows:

ansible-playbook --ask-become-pass networks.yml

The error messages were:

SUDO password: PLAY [Prepare REDFERN Cluster for Oracle GI 12.1 installation (Networking)] **** TASK [Gathering Facts] ********************************************************* ok: [redfern1.yaocm.id.au] TASK [install needed network manager libs] ************************************* changed: [redfern1.yaocm.id.au] => (item=[u'NetworkManager-glib']) TASK [Configure Public LAN Interface for REDFERN RAC] ************************** changed: [redfern1.yaocm.id.au] TASK [Private LAN Interface] *************************************************** fatal: [redfern1.yaocm.id.au]: FAILED! => {"changed": false, "module_stderr": "Shared connection to redfern1.yaocm.id.au closed.\r\n", "module_stdout": "\r\n/tmp/ansible_Hk8ubR/ansible_module_nmcli.py:493: PyGIWarning: NetworkManager was imported without specifying a version first. Use gi.require_version('NetworkManager', '1.0') before import to ensure that the right version gets loaded.\r\n from gi.repository import NetworkManager, NMClient\r\n/tmp/ansible_Hk8ubR/ansible_module_nmcli.py:493: PyGIWarning: NMClient was imported without specifying a version first. Use gi.require_version('NMClient', '1.0') before import to ensure that the right version gets loaded.\r\n from gi.repository import NetworkManager, NMClient\r\nTraceback (most recent call last):\r\n File \"/tmp/ansible_Hk8ubR/ansible_module_nmcli.py\", line 1190, in <module>\r\n main()\r\n File \"/tmp/ansible_Hk8ubR/ansible_module_nmcli.py\", line 1134, in main\r\n nmcli=Nmcli(module)\r\n File \"/tmp/ansible_Hk8ubR/ansible_module_nmcli.py\", line 559, in __init__\r\n self.dns4=' '.join(module.params['dns4'])\r\nTypeError\r\n", "msg": "MODULE FAILURE", "rc": 0} to retry, use: --limit @/etc/ansible/networks.retry PLAY RECAP ********************************************************************* redfern1.yaocm.id.au : ok=3 changed=2 unreachable=0 failed=1

Execute Playbook - Fourth Attempt

I tried to run the playbook as follows:

ansible-playbook --ask-become-pass networks.yml

The error messages were:

SUDO password: PLAY [Prepare REDFERN Cluster for Oracle GI 12.1 installation (Networking)] **** TASK [Gathering Facts] ********************************************************* ok: [redfern1.yaocm.id.au] TASK [install needed network manager libs] ************************************* ok: [redfern1.yaocm.id.au] => (item=[u'NetworkManager-glib']) TASK [Configure Public LAN Interface for REDFERN RAC] ************************** changed: [redfern1.yaocm.id.au] TASK [Private LAN Interface] *************************************************** fatal: [redfern1.yaocm.id.au]: FAILED! => {"changed": false, "module_stderr": "Shared connection to redfern1.yaocm.id.au closed.\r\n", "module_stdout": "\r\n/tmp/ansible_bcHN7Q/ansible_module_nmcli.py:493: PyGIWarning: NetworkManager was imported without specifying a version first. Use gi.require_version('NetworkManager', '1.0') before import to ensure that the right version gets loaded.\r\n from gi.repository import NetworkManager, NMClient\r\n/tmp/ansible_bcHN7Q/ansible_module_nmcli.py:493: PyGIWarning: NMClient was imported without specifying a version first. Use gi.require_version('NMClient', '1.0') before import to ensure that the right version gets loaded.\r\n from gi.repository import NetworkManager, NMClient\r\nTraceback (most recent call last):\r\n File \"/tmp/ansible_bcHN7Q/ansible_module_nmcli.py\", line 1190, in <module>\r\n main()\r\n File \"/tmp/ansible_bcHN7Q/ansible_module_nmcli.py\", line 1134, in main\r\n nmcli=Nmcli(module)\r\n File \"/tmp/ansible_bcHN7Q/ansible_module_nmcli.py\", line 559, in __init__\r\n self.dns4=' '.join(module.params['dns4'])\r\nTypeError\r\n", "msg": "MODULE FAILURE", "rc": 0} to retry, use: --limit @/etc/ansible/networks.retry PLAY RECAP ********************************************************************* redfern1.yaocm.id.au : ok=3 changed=1 unreachable=0 failed=1

Conclusion

I do not understand enough about the nmcli - Manage Networking Ansible module to know what is going on.

I will have to configure the network interfaces by hand.