add oracle instant client ansible role

This commit is contained in:
aaron
2021-08-24 13:29:46 +02:00
parent 3c13cd9cd8
commit f6127f262d
13 changed files with 291 additions and 0 deletions

34
tasks/config.yaml Normal file
View File

@@ -0,0 +1,34 @@
---
- name: ensure oracle instant client group exists
group:
state: present
name: "{{ oic_group }}"
gid: "{{ oic_group_id }}"
- name: ensure oracle instant client user exists
user:
state: present
name: "{{ oic_user }}"
uid: "{{ oic_user_id }}"
group: "{{ oic_group }}"
- name: ensure network/admin subdirectory exists
file:
path: "{{ oic_config_path }}"
state: directory
owner: root
group: root
- name: update the $PATH variable for oracle binaries
copy:
dest: /etc/profile.d/custom-path.sh
content: 'PATH=$PATH:{{ oic_bin_path }}'
- name: push tnsnames.ora
template:
src: tnsnames.ora.j2
dest: "{{ oic_config_path }}/tnsnames.ora"
mode: 0655
owner: "{{ oic_user }}"
group: "{{ oic_group }}"

8
tasks/fetch.yaml Normal file
View File

@@ -0,0 +1,8 @@
---
- name: fetch oracle instant client artifacts
get_url:
url: "{{ oic_package_base_url }}/{{ item.pkg_name }}"
dest: "{{ oic_package_dest }}"
checksum: "{{ item.pkg_hash }}"
loop: "{{ oic_install_packages }}"

21
tasks/install.yaml Normal file
View File

@@ -0,0 +1,21 @@
---
- name: install dependencies
yum:
name: "{{ item }}"
state: present
loop: "{{ oic_dependencies }}"
- name: install oracle instan client packages
yum:
name: "{{ oic_package_dest }}/{{ item.pkg_name }}"
state: present
loop: "{{ oic_install_packages }}"
- name: make sure oracle client is in the library path
lineinfile:
dest: "/etc/ld.so.conf.d/oracle-instantclient.conf"
line: "{{ oic_ld_library_path }}"
insertbefore: "BOF"
create: True
notify: "run ldconfig"

24
tasks/main.yaml Normal file
View File

@@ -0,0 +1,24 @@
---
- name: load variables based on distribution type
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yaml'
- '{{ ansible_os_family }}.yaml'
tags:
- 'oic_vars'
- name: import fetching tasks
import_tasks: fetch.yaml
tags:
- 'oic_fetch'
- name: import installation tasks
import_tasks: install.yaml
tags:
- 'oic_install'
- name: impost configuration tasks
import_tasks: config.yaml
tags:
- 'oic_config'