Now that I have organised all of my playbooks into roles, I can now install the Oracle Grid Infrastructure (GI) software in silent mode. To do this, I need to construct a template for the response file and variables to fill in the blanks.
Following the procedure in C.2.1 Editing a Response File Template. I replaced the responses with Ansible variables.
I copied the sample response file, grid_install.rsp, into the directory, /etc/ansible/roles/oracle_gi/templates, on AUBURN.
scp redfern1:/opt/share/Software/grid/linuxamd64_12102/grid/response/grid_install.rsp /etc/ansible/roles/oracle_gi/templates
I updated the response file, grid_install.rsp, with the original text in grid_install_original.rsp. I used the following command to confirm the changes:
diff grid_install_original.rsp grid_install.rsp
The differences are in diff output with changes in bold
54c54 < ORACLE_HOSTNAME= --- > ORACLE_HOSTNAME={{ ansible_nodename }} 60c60 < INVENTORY_LOCATION= --- > INVENTORY_LOCATION={{ oracle_gi.inventory_location }} 109c109 < oracle.install.option= --- > oracle.install.option=CRS_SWONLY 114c114 < ORACLE_BASE= --- > ORACLE_BASE={{ oracle_gi.oracle_base }} 119c119 < ORACLE_HOME= --- > ORACLE_HOME={{ oracle_gi.oracle_home }}
Based on the variables put into the template file, grid_install.rsp, the contents of /etc/ansible/roles/oracle_gi/vars/main.yml are set to:
--- # vars file for oracle_gi "oracle_gi": "inventory_location": "/opt/app" "oracle_base": "/opt/app/grid" "oracle_home": "/opt/app/12.1.0/grid" ...
I created the following tasks file in /etc/ansible/roles/oracle_gi/tasks/install_gi_sw.yml:
--- # ============================================================================= # Install Oracle GI 12.1.0.2 Software Only: # (1) Create response file for silent installation # ============================================================================= - name: Create response file for silent installation template: src: "grid_install.rsp" dest: "{{ oracle_gi.oracle_base }}/grid_install.rsp" ...
I updated the main tasks file for the oracle_gi group, /etc/ansible/roles/oracle_gi/tasks/main.yml, as follows (changes are in bold):
--- # tasks file for oracle_gi # ============================================================================= # (1) Install Oracle ASMLib Driver # (2) Configure Oracle ASMLib Driver # (3) Install Oracle GI 12.1.0.2 Software Only # ============================================================================== - name: Install and configure Oracle ASMLib driver block: - import_tasks: gi_asm.yml - import_tasks: oracleasm.yml become: yes become_user: root - name: Install Oracle GI 12.1.0.2 Software Only block: - import_tasks: install_gi_sw.yml become: yes become_user: oracle tags: install_gi_sw ...
Because I do not want to run all of the tasks in the main playbook, I have added a tag of install_gi_sw. This allows me to just run this group of tasks.
I have used the block to assign common attributes to a group of tasks.
The privilege escalation is for oracle, not root.
I ran the main playbook, /etc/ansible/sites.yml, 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 : Create response file for silent installation] **************** changed: [redfern1.yaocm.id.au] PLAY RECAP ********************************************************************* redfern1.yaocm.id.au : ok=2 changed=1 unreachable=0 failed=0
Using diff to compare between the template and the generated response file, the following differences were found:
54c54 < ORACLE_HOSTNAME={{ ansible_nodename }} --- > ORACLE_HOSTNAME=redfern1.yaocm.id.au 60c60 < INVENTORY_LOCATION={{ oracle_gi.inventory_location }} --- > INVENTORY_LOCATION=/opt/app 114c114 < ORACLE_BASE={{ oracle_gi.oracle_base }} --- > ORACLE_BASE=/opt/app/grid 119c119 < ORACLE_HOME={{ oracle_gi.oracle_home }} --- > ORACLE_HOME=/opt/app/12.1.0/grid
The variable substitutions were done correctly.
Based on the procedure in C.3 Running the Installer Using a Response File, I updated /etc/ansible/roles/oracle_gi/tasks/install_gi_sw.yml as follows (changes are in bold):
--- # ============================================================================= # Install Oracle GI 12.1 Software Only: # (1) Create response file for silent installation # (2) Install Oracle GI 12.1 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 Software Only in Silent Mode command: "{{ installer_loc }}/runInstaller -silent -noconfig -responseFile {{ response_file }}" args: chdir: "{{ installer_loc }}" creates: "{{ oracle_gi.oracle_home }}/*" register: gi_sw_install_result - debug: var: gi_sw_install_result verbosity: 1 - name: Run root scripts after installation of Oracle GI 12.1 Software block: - name: Run orainstRoot.sh after Oracle GI 12.1 Software Installation command: "{{ oracle_gi.oracle_home }}/orainstRoot.sh" - name: Run root.sh after Oracle GI 12.1 Software Installation command: "{{ oracle_gi.oracle_home }}/root.sh" become: yes become_user: root when: - gi_sw_install_result.changed - gi_sw_install_result|succeeded ...
I have added two (2) facts via the set_fact module:
The installation of the Oracle GI is only attempted if the Oracle Home is empty — this is achieved with the creates argument.
If the installer made changes and ran successfully, then the two (2) root scripts are executed as the root user.
I ran the main playbook, /etc/ansible/sites.yml, as follows (with some debugging output enabled through the -v option):
ansible-playbook --ask-become-pass --tags "install_gi_sw" /etc/ansible/sites.yml -v
The output is:
Using /etc/ansible/ansible.cfg as config file 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] => {"ansible_facts": {"installer_loc": "/opt/share/Software/grid/linuxamd64_12102/grid", "response_file": "/opt/app/grid/grid_install.rsp"}, "changed": false} TASK [oracle_gi : Create response file for silent installation] **************** ok: [redfern1.yaocm.id.au] => {"changed": false, "checksum": "298639b71a6eb841589a876bb9f14f8e80897fd9", "gid": 54321, "group": "oinstall", "mode": "0644", "owner": "oracle", "path": "/opt/app/grid/grid_install.rsp", "secontext": "system_u:object_r:usr_t:s0", "size": 24814, "state": "file", "uid": 54321} TASK [oracle_gi : Install Oracle GI 12.1 Software Only in Silent Mode] ********* changed: [redfern1.yaocm.id.au] => {"changed": true, "cmd": ["/opt/share/Software/grid/linuxamd64_12102/grid/runInstaller", "-silent", "-noconfig", "-responseFile", "/opt/app/grid/grid_install.rsp"], "delta": "0:00:15.183930", "end": "2018-03-17 17:56:38.353572", "rc": 0, "start": "2018-03-17 17:56:23.169642", "stderr": "", "stderr_lines": [], "stdout": "Starting Oracle Universal Installer...\n\nChecking Temp space: must be greater than 415 MB. Actual 44113 MB Passed\nChecking swap space: must be greater than 150 MB. Actual 3967 MB Passed\nPreparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-17_05-56-23PM. Please wait ...", "stdout_lines": ["Starting Oracle Universal Installer...", "", "Checking Temp space: must be greater than 415 MB. Actual 44113 MB Passed", "Checking swap space: must be greater than 150 MB. Actual 3967 MB Passed", "Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-17_05-56-23PM. Please wait ..."]} TASK [oracle_gi : debug] ******************************************************* ok: [redfern1.yaocm.id.au] => { "gi_sw_install_result": { "changed": true, "cmd": [ "/opt/share/Software/grid/linuxamd64_12102/grid/runInstaller", "-silent", "-noconfig", "-responseFile", "/opt/app/grid/grid_install.rsp" ], "delta": "0:00:15.183930", "end": "2018-03-17 17:56:38.353572", "failed": false, "rc": 0, "start": "2018-03-17 17:56:23.169642", "stderr": "", "stderr_lines": [], "stdout": "Starting Oracle Universal Installer...\n\nChecking Temp space: must be greater than 415 MB. Actual 44113 MB Passed\nChecking swap space: must be greater than 150 MB. Actual 3967 MB Passed\nPreparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-17_05-56-23PM. Please wait ...", "stdout_lines": [ "Starting Oracle Universal Installer...", "", "Checking Temp space: must be greater than 415 MB. Actual 44113 MB Passed", "Checking swap space: must be greater than 150 MB. Actual 3967 MB Passed", "Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-17_05-56-23PM. Please wait ..." ] } } TASK [oracle_gi : Run orainstRoot.sh after Oracle GI 12.1 Software Installation] *** fatal: [redfern1.yaocm.id.au]: FAILED! => {"changed": false, "cmd": "/opt/app/12.1.0/grid/orainstRoot.sh", "msg": "[Errno 2] No such file or directory", "rc": 2} to retry, use: --limit @/etc/ansible/sites.retry PLAY RECAP ********************************************************************* redfern1.yaocm.id.au : ok=5 changed=1 unreachable=0 failed=1
This is unexpected.
On REDFERN1, I executed the installer manually as follows:
sudo -u oracle /opt/share/Software/grid/linuxamd64_12102/grid/runInstaller -silent -noconfig -responseFile /opt/app/grid/grid_install.rsp
The output was:
[sudo] password for douglas: Starting Oracle Universal Installer... Checking Temp space: must be greater than 415 MB. Actual 43625 MB Passed Checking swap space: must be greater than 150 MB. Actual 3967 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-17_11-55-11PM. Please wait ...[douglas@redfern1 ~]$ [FATAL] [INS-10105] The given response file /opt/app/grid/grid_install.rsp is not valid. CAUSE: Syntactically incorrect response file. Either unexpected variables are specified or expected variables are not specified in the response file. ACTION: Refer the latest product specific response file template SUMMARY: - cvc-complex-type.2.4.a: Invalid content was found starting with element 'cat'. One of '{oracle.install.option, INVENTORY_LOCATION, UNIX_GROUP_NAME, ORACLE_HOME, oracle.install.IsBuiltInAccount, oracle.install.OracleHomeUserName, oracle.install.OracleHomeUserPassword, oracle.install.crs.config.ClusterType, oracle.install.crs.config.autoConfigureClusterNodeVIP, oracle.install.bigcluster.config.TargetHubSize, oracle.install.crs.config.clusterNodes, oracle.install.crs.managementdb.configure, oracle.install.crs.config.sharedFileSystemStorage.ocrLocations, oracle.install.crs.config.gpnp.configureGNS, oracle.install.crs.config.assignNodeTypeAsAuto, oracle.install.crs.config.gpnp.scanPort, oracle.install.crs.config.useIPMI, oracle.install.asm.OSDBA, oracle.install.crs.nodeListenerUser, oracle.install.asm.diskGroup.redundancy, oracle.install.asm.diskGroup.AUSize, oracle.install.asm.monitorPassword, oracle.install.asm.ClientDataFile, oracle.install.config.managementOption, oracle.install.config.omsPort, oracle.installer.autoupdates.option, oracle.installer.autoupdates.downloadUpdatesLoc, AUTOUPDATES_MYORACLESUPPORT_USERNAME, AUTOUPDATES_MYORACLESUPPORT_PASSWORD, PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PWD, PROXY_REALM, ConfigWizard}' is expected. A log of this session is currently saved as: /tmp/OraInstall2018-03-17_11-55-11PM/installActions2018-03-17_11-55-11PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location.
This needs further investigation.