I am writing an ansible script to automate the task of oracle database shutdown and startup. I am facing a difficulty in reading the environment variables from the XML files.
[oracle@rac1 ContentsXML]$ more inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2014, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
<SAVED_WITH>12.1.0.2.0</SAVED_WITH>
<MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/grid/app/product/12.1.0" TYPE="O" IDX="1" CRS="true"/>
<HOME NAME="OraDB12Home1" LOC="/oracle/app/product/12.1.0" TYPE="O" IDX="2"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
[oracle@rac1 ContentsXML]$
One challenge for this is the path of this XML file is not same on every server.
Can someone please help me to fetch the exact path of the xml file and grep the value of OraDB12Home1= /oracle/app/product/12.1.0 out of xml and store in ansible variable?