🔧 Automating Oracle GoldenGate 21c Silent Installation with Ansible
This blog post walks you through the silent installation of Oracle GoldenGate 21c on Linux using an Ansible playbook. Automation is key to efficient software deployment, and Ansible provides a powerful and agentless way to manage your infrastructure and applications. This playbook streamlines the GoldenGate installation process, ensuring consistency and reducing manual errors.
Prerequisites
Before you begin, ensure you have the following:
- Ansible Installed: You need to have Ansible installed and configured on your control machine.
- Target Hosts Configured: Your target Linux hosts where you want to install GoldenGate should be accessible via SSH from your Ansible control machine.
- Oracle GoldenGate 21c Software: Download the Oracle GoldenGate 21c software (e.g.,
213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip
) and have it accessible on your Ansible control machine or a location accessible by the target hosts. - Oracle Database Installed: An existing Oracle Database installation (in this example, 19.3.0) is required as GoldenGate often interacts with a database.
- User and Group: Ensure the specified user (
ggudb
) and group (oinstall
) exist on the target hosts.
Ansible Playbook Breakdown
Below is the Ansible playbook used for the silent installation:
---
- name: Install Oracle GoldenGate 21c in Silent Mode
hosts: "{{ hostlist }}"
become: yes
vars:
ogg_user: ggudb
ogg_group: oinstall
ogg_zip_file: 213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip
ogg_base_dir: /acfs01/ogg21c
ogg_home: /opt/app/ogg21c
oracle_home: /opt/oracle/product/19.3.0/db_1
inventory_location: /opt/app/oraInventory
response_file_path: "{{ ogg_base_dir }}/fbo_ggs_Linux_x64_Oracle_shiphome/Disk1/response/oggcore.rsp"
manager_port: 7809
tasks:
- name: Ensure base and target directories exist
file:
path: "{{ item }}"
state: directory
owner: "{{ ogg_user }}"
group: "{{ ogg_group }}"
mode: '0755'
loop:
- "{{ ogg_base_dir }}"
- "{{ ogg_home }}"
- "{{ inventory_location }}"
- name: Copy GoldenGate ZIP file to target
copy:
src: "{{ ogg_zip_file }}"
dest: "{{ ogg_base_dir }}/{{ ogg_zip_file }}"
owner: "{{ ogg_user }}"
group: "{{ ogg_group }}"
mode: '0644'
- name: Unzip GoldenGate software
unarchive:
src: "{{ ogg_base_dir }}/{{ ogg_zip_file }}"
dest: "{{ ogg_base_dir }}"
remote_src: yes
owner: "{{ ogg_user }}"
group: "{{ ogg_group }}"
- name: Create response file for silent install
copy:
dest: "{{ response_file_path }}"
content: |
oracle.install.responseFileVersion=/oracle/install/rspfmt_ogginstall_response_schema_v21_1_0
INSTALL_OPTION=ORA21c
SOFTWARE_LOCATION={{ ogg_home }}
START_MANAGER=FALSE
MANAGER_PORT={{ manager_port }}
DATABASE_LOCATION={{ oracle_home }}
INVENTORY_LOCATION={{ inventory_location }}
UNIX_GROUP_NAME={{ ogg_group }}
owner: "{{ ogg_user }}"
group: "{{ ogg_group }}"
mode: '0644'
- name: Run GoldenGate silent installer
command: >
./runInstaller -silent -showprogress -waitforcompletion -ignoreSysPrereqs
-responseFile {{ response_file_path }}
args:
chdir: "{{ ogg_base_dir }}/fbo_ggs_Linux_x64_Oracle_shiphome/Disk1"
become_user: "{{ ogg_user }}"
Let's break down the playbook:
<strong><code>---</code></strong>
: Indicates the start of a YAML document.<strong><code>- name: Install Oracle GoldenGate 21c in Silent Mode</code></strong>
: A descriptive name for the playbook.<strong><code>hosts: "{{ hostlist }}"</code></strong>
: Specifies the target hosts where the playbook will run. Thehostlist
variable should be defined in your Ansible inventory or via command-line arguments.<strong><code>become: yes</code></strong>
: Enables privilege escalation (usingsudo
) to perform administrative tasks.<strong><code>vars:</code></strong>
: Defines variables used throughout the playbook, making it easier to customize and manage.ogg_user
: The user who will own the GoldenGate installation files.ogg_group
: The group for the GoldenGate installation files.ogg_zip_file
: The name of the GoldenGate software ZIP file.ogg_base_dir
: The base directory where the GoldenGate software will be copied and extracted.ogg_home
: The actual GoldenGate home directory where the software will be installed.oracle_home
: The home directory of your existing Oracle Database installation.inventory_location
: The location for the Oracle inventory directory.response_file_path
: The full path to the GoldenGate silent installation response file.manager_port
: The port number for the GoldenGate Manager process.
<strong><code>tasks:</code></strong>
: A list of tasks to be executed on the target hosts.<strong><code>Ensure base and target directories exist</code></strong>
: This task uses thefile
module to create the necessary directories (ogg_base_dir
,ogg_home
,inventory_location
) if they don't exist. It also sets the ownership, group, and permissions for these directories. Theloop
directive iterates through the list of directories.<strong><code>Copy GoldenGate ZIP file to target</code></strong>
: This task uses thecopy
module to transfer the GoldenGate software ZIP file from the Ansible control machine (or a specifiedsrc
path) to the target host'sogg_base_dir
. It also sets the ownership, group, and permissions for the copied file.<strong><code>Unzip GoldenGate software</code></strong>
: This task uses theunarchive
module to extract the contents of the GoldenGate ZIP file in theogg_base_dir
.remote_src: yes
indicates that the source file is already on the remote host. Ownership and group are also set for the extracted files.<strong><code>Create response file for silent install</code></strong>
: This task uses thecopy
module with thecontent
parameter to create the silent installation response file (oggcore.rsp
) on the target host. This file contains the necessary parameters for a silent, non-interactive installation. The variables defined earlier are used to populate the response file.<strong><code>Run GoldenGate silent installer</code></strong>
: This task uses thecommand
module to execute the GoldenGate installer (runInstaller
) in silent mode.-silent
: Enables silent installation.-showprogress
: Displays the installation progress.-waitforcompletion
: Waits for the installer to finish.-ignoreSysPrereqs
: Skips system prerequisite checks (use with caution in production environments).-responseFile {{ response_file_path }}
: Specifies the path to the response file created in the previous task.args: chdir
: Sets the working directory for the command to the location of therunInstaller
executable.become_user: "{{ ogg_user }}"
: Executes the installer as the specifiedogg_user
.
How to Run the Playbook
- Save the playbook: Save the above content as a YAML file (e.g.,
install_ogg.yml
). - Configure your inventory: Create an Ansible inventory file (e.g.,
inventory
) that lists your target hosts under the group defined in thehosts
section of the playbook (or use a variable likehostlist
and provide it during execution). - Run the playbook: Execute the playbook from your Ansible control machine using the
ansible-playbook
command:ansible-playbook -i inventory install_ogg.yml -e "hostlist=your_target_hosts"
Replace
inventory
with the name of your inventory file andyour_target_hosts
with the actual hostname(s) or group name from your inventory. If you've definedhostlist
directly in your inventory, you can omit the-e
option.
Conclusion
This Ansible playbook provides a robust and repeatable way to silently install Oracle GoldenGate 21c. By leveraging the power of Ansible, you can automate this process across multiple servers, ensuring consistency and saving valuable time and effort. Remember to adjust the variables in the playbook to match your specific environment and requirements. This automation approach is crucial for managing and deploying complex software like Oracle GoldenGate efficiently.
Comments
Post a Comment