-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathvalidatedb.yml
26 lines (23 loc) · 995 Bytes
/
validatedb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- hosts: oel75
tasks:
- name: db19c_create | validate CDB
remote_user: "{{ root_user }}"
become: yes
become_user: "{{ oracle_user }}"
when: inventory_hostname in groups['oel75']
shell: export ORACLE_HOME={{ oracle_home }}; export ORACLE_SID={{ cdb_name }}; export PATH=$PATH:$ORACLE_HOME/bin; echo "{{ item }};" | {{ oracle_home }}/bin/sqlplus / as sysdba
register: sqlplus_cdbvalidate
failed_when: "'ERROR' in sqlplus_cdbvalidate.stdout or sqlplus_cdbvalidate.rc != 0"
with_items:
- select name, open_mode, cdb, database_role from v\$database
- show pdbs
- name: display details of sb sql output
debug: msg="{{ item }}"
with_items: "{{ sqlplus_cdbvalidate.results|map(attribute='stdout')|list }}"
vars:
cdb_name: "ORCLCDB"
pdb_name: ORCLPDB1
syspass: "Bangla123"
oracle_home: "/opt/oracle/product/19c/dbhome_1"
root_user: root
oracle_user: oracle