161 lines
4.1 KiB
YAML
161 lines
4.1 KiB
YAML
---
|
|
# tasks file restconfig
|
|
- name: Create directory for network files
|
|
file:
|
|
path: /opt/oracle/network
|
|
state: directory
|
|
owner: oracle
|
|
group: dba
|
|
mode: '0755'
|
|
|
|
############################
|
|
# copy Basis tnsnames.ora und sqlnet.ora
|
|
###########################
|
|
- name: copy tnsnames.ora
|
|
copy:
|
|
src: roles/restconfig/templates/tnsnames.ora
|
|
dest: "/opt/oracle/network"
|
|
owner: oracle
|
|
group: dba
|
|
|
|
- name: copy sqlnet.ora
|
|
copy:
|
|
src: roles/restconfig/templates/sqlnet.ora
|
|
dest: "/opt/oracle/network"
|
|
owner: oracle
|
|
group: dba
|
|
|
|
###################################
|
|
# Vorhandene ORACLE_HOMEs einlesen
|
|
###################################
|
|
|
|
- name: Find oracle_homes
|
|
find:
|
|
paths: /opt/oracle/db
|
|
file_type: directory
|
|
recurse: no
|
|
register: files_matched
|
|
|
|
|
|
############################
|
|
# Verlinkung der tnsnnames etc. nach /opt/oracle/network
|
|
###########################
|
|
- name: linking tnsnames.ora
|
|
file:
|
|
src: /opt/oracle/network/tnsnames.ora
|
|
dest: "{{ item.path }}/network/admin/tnsnames.ora"
|
|
force: yes
|
|
owner: oracle
|
|
group: dba
|
|
follow: no
|
|
state: link
|
|
loop: "{{ files_matched.files|flatten(levels=1) }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|
|
|
|
- name: linking sqlnet.ora
|
|
file:
|
|
src: /opt/oracle/network/sqlnet.ora
|
|
dest: "{{ item.path }}/network/admin/sqlnet.ora"
|
|
force: yes
|
|
owner: oracle
|
|
group: dba
|
|
follow: no
|
|
state: link
|
|
loop: "{{ files_matched.files|flatten(levels=1) }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|
|
|
|
- name: linking listener.ora
|
|
file:
|
|
src: /opt/oracle/network/listener.ora
|
|
dest: "{{ item.path }}/network/admin/listener.ora"
|
|
force: yes
|
|
owner: oracle
|
|
group: dba
|
|
follow: no
|
|
state: link
|
|
loop: "{{ files_matched.files|flatten(levels=1) }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|
|
|
|
############################
|
|
# softlinks für Networker anlegen
|
|
###########################
|
|
|
|
- name: Softlink libobk.so im lib der ORACLE_HOMEs anlegen
|
|
file:
|
|
src: /usr/lib/libnsrora.so
|
|
dest: "{{ item.path }}/lib/libobk.so"
|
|
force: yes
|
|
owner: oracle
|
|
group: dba
|
|
follow: no
|
|
state: link
|
|
loop: "{{ files_matched.files|flatten(levels=1) }}"
|
|
loop_control:
|
|
label: "{{ item.path }}"
|
|
|
|
|
|
##############################
|
|
# addin entries to profile
|
|
##############################
|
|
- name: Further entries for profile
|
|
become_user: oracle
|
|
become: yes
|
|
lineinfile:
|
|
path: /home/oracle/.bash_profile
|
|
regexp: '^# Below this line.*\n# --*'
|
|
insertafter: '^# -----.*'
|
|
line: |
|
|
# weitere Aliase
|
|
alias cdrman='cd ${BE_ORA_ADMIN_SID}/rman'
|
|
alias tf='tail -f '
|
|
alias tan='tail -f nohup.out'
|
|
export PATH=$PATH:/sw/RS/LITO/rhl
|
|
#Titelzeile
|
|
RS_UNAM=`uname`
|
|
RS_HOST=`hostname | cut -d. -f1`
|
|
RS_SIDLIST=`echo $BE_SIDLIST | sed 's/emagent[^ ]*//g' | sed 's/rdbms[^ ]*//g' | tr -s " "`
|
|
if [ "$RS_UNAM" = "Linux" ]; then
|
|
RS_IP=`hostname -i`
|
|
else
|
|
RS_IP=`nslookup $RS_HOST | grep "Address" | tail -1 | awk '{print $2}'`
|
|
fi
|
|
xtitle "$RS_HOST - $RS_IP ($RS_UNAM) $RS_SIDLIST"
|
|
|
|
##############################
|
|
# linking emagent with latest oracle_home
|
|
##############################
|
|
|
|
- name: Find out latest oracle_home
|
|
find:
|
|
paths: /opt/oracle/db
|
|
file_type: directory
|
|
recurse: no
|
|
register: files
|
|
|
|
# hoechste ORACLE_HOME Version - soweit dies ueber alphabetische Sortierung moeglich ist
|
|
- debug: msg="{{ files.files | sort(attribute='path', reverse=True) | map(attribute='path') | list }}"
|
|
register: sortiert
|
|
# sortiert.msg[0] enthaelt die hoechste OH Version "/opt/oracle/db/19.13"
|
|
|
|
- name: Check if directory exists
|
|
stat:
|
|
path: "{{ emagent_inst_dir }}"
|
|
register: directory_data
|
|
|
|
- name: Softlink emagent
|
|
file:
|
|
src: "{{ sortiert.msg[0] }}/perl"
|
|
dest: "{{ emagent_inst_dir }}/perl"
|
|
force: yes
|
|
owner: oracle
|
|
group: dba
|
|
follow: no
|
|
state: link
|
|
when: directory_data.stat.exists
|
|
|
|
- debug: msg="Verzeichnis {{ emagent_inst_dir }} auf Server nicht gefunden ln -s {{ sortiert.msg[0] }}/perl {{ emagent_inst_dir }}/perl"
|
|
when: not directory_data.stat.exists
|