playbook
---
- name: Create Oracle Restore Point
hosts: localhost
tasks:
- include_role:
name: oracle-restore-point
main.yml
---
- name: Setup Some Oracle Settings
set_fact:
oracle_cmd: "sqlplus '{{database_admin_user}}/{{database_admin_pwd}}@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={{ database_scan }})(PORT={{ database_port }}))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={{ database_service }})))'"
nls_lang: AMERICAN_AMERICA.UTF8
date_var: "{{ansible_date_time.epoch}}"
- name: Run Some Query Through Oracle SQLPlus
shell: "echo \"CREATE RESTORE POINT {{database_sid}}_{{date_var}};\" | {{ oracle_cmd }}"
environment:
PATH: "{{ oracle_home }}:{{ ansible_env.PATH }}"
ORACLE_HOME: "{{ oracle_home }}"
LD_LIBRARY_PATH: "{{ oracle_home }}"
TNS_ADMIN: "{{ oracle_home }}"
NLS_LANG: "{{ nls_lang }}"
Variables:
---
# Database Config
database_scan: <scan-name>
database_port: <port>
database_sid: <sid>
database_service: <service-name>
database_home: <oracle-home>
# Database Credentials
database_admin_user: <username>
database_admin_pwd: "{{ vault.database_admin_pwd }}"
database_sys_pwd: "{{ vault.database_sys_pwd }}"