2018-03-20 Ansible Playbook for Install GI Software (2)



Overview

Following the failure to install the Oracle 12.1.0.2 Grid Infrastructure (GI) software as described in 2018-03-17 Ansible Playbook to Install GI Software , I had to generate the response file using the Oracle Universal Installer (OUI) in interactive mode. This generated response file was then used to update the template file. This eventually worked.

References

Analysis

There were four (4) main issues that caused the previous installations to fail:

  1. Response file had invalid content.
  2. Response file was missing one or more settings.
  3. Installer spawns a separate process which was not monitored by Ansible.
  4. Installer was failing on failed system prerequisites.

Invalid Content in Response File

The important part of the error message returned when I ran the command manually was:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'cat'.

What had happened was that I had copied the cat command into the response file (both modified and original) as well as the following output.

Missing Settings in Response File

The modified response file was missing values for the following three (3) settings:

  1. oracle.install.asm.OSDBA
  2. oracle.install.asm.OSOPER
  3. oracle.install.asm.OSASM

Installer Runs Asynchronously

Ansible assumes that commands run synchronously. However, the OUI spawns a separate Java process which does the installation.

Failed System Prerequisites

In my first attempt at GI installation , Step 16: Prerequisite Checks failed with prerequisite check failures.

Procedure

Update Template File

On AUBURN . the template file, /etc/ansible/roles/templates/grid_install.rsp , with the following changes (in bold ) based on diff output:

53c53
< ORACLE_HOSTNAME={{ ansible_nodename }}
---
> ORACLE_HOSTNAME=
59c59
< INVENTORY_LOCATION={{ oracle_gi.inventory_location }}
---
> INVENTORY_LOCATION=
108c108
< oracle.install.option=CRS_SWONLY
---
> oracle.install.option=
113c113
< ORACLE_BASE={{ oracle_gi.oracle_base }}
---
> ORACLE_BASE=
118c118
< ORACLE_HOME={{ oracle_gi.oracle_home }}
---
> ORACLE_HOME=
134c134
< oracle.install.asm.OSDBA={{ oracle_gi.asm.OSDBA.name }}
---
> oracle.install.asm.OSDBA=
141c141
< oracle.install.asm.OSOPER={{ oracle_gi.asm.OSOPER.name }}
---
> oracle.install.asm.OSOPER=
147c147
< oracle.install.asm.OSASM={{ oracle_gi.asm.OSASM.name }}
---
> oracle.install.asm.OSASM=

Now I am adding the three (3) ASM groups to the response file:

  1. OSDBA
  2. OSOPER
  3. OSASM

I also deleted the first line that contained the cat command from both the original and modified response files.

Update Variables File

On AUBURN . the variables file, /etc/ansible/roles/oracle_gi/vars/main.yml , with the following changes (in bold ):

---
# vars file for oracle_gi
"oracle_gi":
  "inventory_location": "/opt/app/oraInventory"
  "oracle_base":        "/opt/app/grid"
  "oracle_home":        "/opt/app/12.1.0/grid"
  "asm":
    "OSDBA":
      "name":           "asmdba"
    "OSOPER":
      "name":           "asmoper"
    "OSASM":
      "name":           "asmadmin"
...

The extra variables are needed for the additional settings in the response file. The complex structure allows me to merge these variables into the Oracle user variable file sometime in the future.

Update Tasks File

On AUBURN . the tasks file for installing the GI software ( /etc/ansible/roles/oracle_gi/tasks/install_gi_sw.yml ) now contains (changes are in bold ):

---
# =============================================================================
# Install Oracle GI 12.1.0.2 Software Only:
# (1) Create response file for silent installation
# (2) Install Oracle GI 12.1.0.2 Software Only in Silent Mode
# (3) Run root scripts
# =============================================================================
- set_fact:
    response_file: "{{ oracle_gi.oracle_base }}/grid_install.rsp"
    installer_loc: "/opt/share/Software/grid/linuxamd64_12102/grid"

- name:            Create response file for silent installation
  template:
    src:           "grid_install.rsp"
    dest:          "{{ response_file }}"

- name:            Install Oracle GI 12.1.0.2 Software Only in Silent Mode
  command:         "{{ installer_loc }}/runInstaller -silent -noconfig -responseFile {{ response_file }} -waitforcompletion -ignorePrereq"
  args:
    chdir:         "{{ installer_loc }}"
    creates:       "{{ oracle_gi.oracle_home }}/*"
  register:        gi_sw_install_result
  
- debug:
    var:           gi_sw_install_result.stdout_lines
    verbosity:     0

- name:            Run root scripts after installation of Oracle GI 12.1.0.2 Software
  block:
  - name:          Verifies orainstRoot.sh exists
    stat:
      path:        "{{ oracle_gi.inventory_location }}/orainstRoot.sh"
    register:      orainstRoot_stat

  - name:          Run orainstRoot.sh after Oracle GI 12.1.0.2 Software Installation
    command:       "{{ oracle_gi.inventory_location }}/orainstRoot.sh"
    register:      orainstRoot
    when:          orainstRoot_stat.stat.exists
  
  - debug:
      var:         orainstRoot.stdout_lines
      verbosity:   0
    when:          orainstRoot is defined

  - name:          Run root.sh after Oracle GI 12.1.0.2 Software Installation
    command:       "{{ oracle_gi.oracle_home }}/root.sh"
    register:      root_sh

  - debug:
      var:         root_sh.stdout_lines
    when:          root_sh is defined
  become:          yes
  become_user:     root
  when:
  - gi_sw_install_result.changed
  - gi_sw_install_result|succeeded
...

I added two (2) extra parameters to the runInstaller call:

-waitforcompletion
Run OUI in synchronous modeā€”do no spawn a separate process.
-ignorePrereq
Ignore any failues in the prerequisite checks

Added debug modules to dump out the standard output from the command calls.

The command call for orainstRoot.sh only runs if orainstRoot.sh exists.

Successful Run

I used the following command on AUBURN to run the install GI portion of the main playbook:

ansible-playbook --ask-become-pass --tags "install_gi_sw" /etc/ansible/sites.yml

The output was:

SUDO password: 

PLAY [redfern1.yaocm.id.au] ****************************************************

TASK [Gathering Facts] *********************************************************
ok: [redfern1.yaocm.id.au]

TASK [oracle_gi : set_fact] ****************************************************
ok: [redfern1.yaocm.id.au]

TASK [oracle_gi : Create response file for silent installation] ****************
changed: [redfern1.yaocm.id.au]

TASK [oracle_gi : Install Oracle GI 12.1.0.2 Software Only in Silent Mode] *****
changed: [redfern1.yaocm.id.au]

TASK [oracle_gi : debug] *******************************************************
ok: [redfern1.yaocm.id.au] => {
    "gi_sw_install_result.stdout_lines": [
        "Starting Oracle Universal Installer...", 
        "", 
        "Checking Temp space: must be greater than 415 MB.   Actual 42991 MB    Passed", 
        "Checking swap space: must be greater than 150 MB.   Actual 3965 MB    Passed", 
        "Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-20_09-44-17PM. Please wait ...You can find the log of this install session at:", 
        " /opt/app/oraInventory/logs/installActions2018-03-20_09-44-17PM.log", 
        "The installation of Oracle Grid Infrastructure 12c was successful.", 
        "Please check '/opt/app/oraInventory/logs/silentInstall2018-03-20_09-44-17PM.log' for more details.", 
        "", 
        "As a root user, execute the following script(s):", 
        "\t1. /opt/app/oraInventory/orainstRoot.sh", 
        "\t2. /opt/app/12.1.0/grid/root.sh", 
        "", 
        "", 
        "", 
        "Successfully Setup Software.", 
        "As install user, execute the following script to complete the configuration.", 
        "\t1. /opt/app/12.1.0/grid/cfgtoollogs/configToolAllCommands RESPONSE_FILE=<response_file>", 
        "", 
        " \tNote:", 
        "\t1. This script must be run on the same host from where installer was run. ", 
        "\t2. This script needs a small password properties file for configuration assistants that require passwords (refer to install guide documentation)."
    ]
}

TASK [oracle_gi : Verifies orainstRoot.sh exists] ******************************
ok: [redfern1.yaocm.id.au]

TASK [oracle_gi : Run orainstRoot.sh after Oracle GI 12.1.0.2 Software Installation] ***
changed: [redfern1.yaocm.id.au]

TASK [oracle_gi : debug] *******************************************************
ok: [redfern1.yaocm.id.au] => {
    "orainstRoot.stdout_lines": [
        "Changing permissions of /opt/app/oraInventory.", 
        "Adding read,write permissions for group.", 
        "Removing read,write,execute permissions for world.", 
        "", 
        "Changing groupname of /opt/app/oraInventory to oinstall.", 
        "The execution of the script is complete."
    ]
}

TASK [oracle_gi : Run root.sh after Oracle GI 12.1.0.2 Software Installation] ***
changed: [redfern1.yaocm.id.au]

TASK [oracle_gi : debug] *******************************************************
ok: [redfern1.yaocm.id.au] => {
    "root_sh.stdout_lines": [
        "Check /opt/app/12.1.0/grid/install/root_redfern1.yaocm.id.au_2018-03-20_21-48-29.log for the output of root script"
    ]
}

PLAY RECAP *********************************************************************
redfern1.yaocm.id.au       : ok=10   changed=4    unreachable=0    failed=0

Verify Idempotency

On AUBURN, the idempotency of this playbook was verified as follows:

ansible-playbook --ask-become-pass --tags "install_gi_sw" /etc/ansible/sites.yml

The output was:

SUDO password: 

PLAY [redfern1.yaocm.id.au] ****************************************************

TASK [Gathering Facts] *********************************************************
ok: [redfern1.yaocm.id.au]

TASK [oracle_gi : set_fact] ****************************************************
ok: [redfern1.yaocm.id.au]

TASK [oracle_gi : Create response file for silent installation] ****************
ok: [redfern1.yaocm.id.au]

TASK [oracle_gi : Install Oracle GI 12.1.0.2 Software Only in Silent Mode] *****
ok: [redfern1.yaocm.id.au]

TASK [oracle_gi : debug] *******************************************************
ok: [redfern1.yaocm.id.au] => {
    "gi_sw_install_result.stdout_lines": [
        "skipped, since /opt/app/12.1.0/grid/* exists"
    ]
}

TASK [oracle_gi : Verifies orainstRoot.sh exists] ******************************
skipping: [redfern1.yaocm.id.au]

TASK [oracle_gi : Run orainstRoot.sh after Oracle GI 12.1.0.2 Software Installation] ***
skipping: [redfern1.yaocm.id.au]

TASK [oracle_gi : debug] *******************************************************
skipping: [redfern1.yaocm.id.au]

TASK [oracle_gi : Run root.sh after Oracle GI 12.1.0.2 Software Installation] ***
skipping: [redfern1.yaocm.id.au]

TASK [oracle_gi : debug] *******************************************************
skipping: [redfern1.yaocm.id.au]

PLAY RECAP *********************************************************************
redfern1.yaocm.id.au       : ok=5    changed=0    unreachable=0    failed=0