. I have different oralce_home like 11.2.0 and 12.1.0 how to specify different oracle_home using ansible script. Please suggest me .As you can see default in roles it takes that values…
you can use “environment” at the end of playbook
tasks:
…
…
handlers:
…
…
environment:
INSTALL_DIR: /opt/edge
Or you can use group_vars to set different environment variables
For what its worth I found I had set the following to get sqlplus working
LD_LIBRARY_PATH
ORACLE_BASE
TNS_ADMIN
PATH
ORACLE_HOME
NLS_DATE_FORMAT
what am here doing is automating db tasks after ospatch apply . we have different version of database homes are there. Am using roles to write ansible script.
Here i have written like this.
roles
– binaries_relink
– defaults
main.yml
oracle_home: /oracle/product/12.1.0
oracle_base: /oracle
tns_admin: “{{ oracle_home }}/network/admin”
am setting like this
In tasks
main.yml am giving what need to be done.
Here in defaults which oracle_home i specifiy it takes that only . suppose i want to add 11g home also like oracle_home=/oracle/product/11.2.0 so how to do this…
See the examples here for how you can set environment:
https://docs.ansible.com/ansible/devel/user_guide/playbooks_environment.html