|
24 | 24 | debug:
|
25 | 25 | msg: "{{ catalog }} exists in tnsnames: {{ tnsnames_entry_exists }}"
|
26 | 26 |
|
| 27 | +- name: Get Passwords |
| 28 | + include_tasks: get_facts.yml |
| 29 | + |
27 | 30 | - name: Add catalog connect identifier to {{ oracle_home.stdout }}/network/admin/tnsnames.ora
|
28 | 31 | blockinfile:
|
29 | 32 | backup:
|
|
38 | 41 | (CONNECT_TIMEOUT=10)
|
39 | 42 | (RETRY_COUNT=3)
|
40 | 43 | (ADDRESS_LIST=
|
41 |
| - (ADDRESS = (PROTOCOL = TCP)(HOST={{ hostvars[groups['rman_primarydb'][0]]['inventory_hostname'] }})(PORT = 1521)) |
| 44 | + (ADDRESS = (PROTOCOL = TCP)(HOST={{ catalog_hostname }})(PORT = 1521)) |
42 | 45 | )
|
43 |
| - (CONNECT_DATA=(SERVICE_NAME={{ catalog }}_TAF)) |
| 46 | + (CONNECT_DATA=(SERVICE_NAME=RCV_TAF)) |
44 | 47 | )
|
45 | 48 |
|
46 | 49 | owner: "oracle"
|
47 | 50 | marker: "# {mark} {{ marker_name }}"
|
48 | 51 | when: not tnsnames_entry_exists
|
49 | 52 |
|
50 |
| -- name: Check we can connect to the catalog |
51 |
| - block: |
52 |
| - - name: Get catalog rman password |
53 |
| - shell: | |
54 |
| - export PATH=$PATH:/usr/local/bin |
55 |
| - INSTANCEID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id) |
56 |
| - ENVIRONMENT_NAME=$(aws ec2 describe-tags --filters "Name=resource-id,Values=${INSTANCEID}" "Name=key,Values=environment-name" --query "Tags[].Value" --output text) |
57 |
| - DELIUS_ENVIRONMENT=$(aws ec2 describe-tags --filters "Name=resource-id,Values=${INSTANCEID}" "Name=key,Values=delius-environment" --query "Tags[].Value" --output text) |
58 |
| - APPLICATION=$(aws ec2 describe-tags --filters "Name=resource-id,Values=${INSTANCEID}" "Name=key,Values=application" --query "Tags[].Value" --output text | sed 's/-core//') |
59 |
| - aws secretsmanager get-secret-value --secret-id ${ENVIRONMENT_NAME}-${DELIUS_ENVIRONMENT}-${APPLICATION}-dba-passwords --region {{ region }} --query SecretString --output text| jq -r .rman |
60 |
| - changed_when: false |
61 |
| - register: rman_password |
62 |
| - no_log: true |
63 |
| - |
64 |
| - - name: Attempt to connect to the catalog as rman |
65 |
| - shell: |
66 |
| - cmd: | |
67 |
| - . ~/.bash_profile |
68 |
| - sqlplus -s /nolog<< EOF |
69 |
| - whenever sqlerror exit failure |
70 |
| - connect rman19c/{{ rman_password.stdout }}@{{ catalog }} |
71 |
| - EOF |
72 |
| - become_user: oracle |
73 |
| - changed_when: false |
74 |
| - register: rman_connect |
75 |
| - no_log: true |
| 53 | +- name: Attempt to connect to the catalog as rman |
| 54 | + shell: |
| 55 | + cmd: | |
| 56 | + . ~/.bash_profile |
| 57 | + sqlplus -s /nolog<< EOF |
| 58 | + whenever sqlerror exit failure |
| 59 | + connect rcvcatowner/{{ rcvcatowner_password }}@{{ catalog }} |
| 60 | + EOF |
| 61 | + changed_when: false |
| 62 | + register: rman_connect |
| 63 | + no_log: true |
76 | 64 |
|
77 |
| - - name: Display connection result |
78 |
| - debug: |
79 |
| - msg: "Catalog connection good" |
80 |
| - when: rman_connect.rc == 0 |
| 65 | +- name: Display connection result |
| 66 | + debug: |
| 67 | + msg: "Catalog connection good" |
| 68 | + when: rman_connect.rc == 0 |
0 commit comments