Take a look at the xml module: https://docs.ansible.com/ansible/latest/modules/xml_module.html More specifically the 3rd example, to retrieve information
On Sat, 16 May 2020 at 08:30, Akshay Bora <[email protected]> wrote: > > Hi Everyone, > > 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. > > Sample XML File: > > [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? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/d78cb9de-e120-4f5e-9414-8576f9c84632%40googlegroups.com. -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwP_yBqXgyOMHrGd8J0KuVDGL6H8b6s%2BQnD2BpzdrMWGfA%40mail.gmail.com.
