Thanks Dick, I will try this and let you know , as of now I am getting an error of installing lxml module, will fix it first and try. Thanks a ton.
On Sat, May 16, 2020 at 3:17 PM Dick Visser <[email protected]> wrote: > This should work: > > - xml: > path: inventory.xml > xpath: "/INVENTORY/HOME_LIST/HOME[@NAME='OraDB12Home1']" > content: attribute > register: out > > - set_fact: > db12home: "{{ out.matches.0.HOME.LOC }}" > > > On Sat, 16 May 2020 at 11:44, Akshay Bora <[email protected]> wrote: > > > > Thanks Dick Visser, I am trying that module. > > > > On Saturday, May 16, 2020 at 12:00:07 PM UTC+5:30, Akshay Bora 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/1215d595-71e2-4a77-a15e-5f6b7552c030%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/CAL8fbwOGYxiOXGRjTznHRmxaewSgCAje3y-QQo_JybJA%3DjrvEw%40mail.gmail.com > . > -- 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/CAGCD-uQE5sWR8OcpUzJ90PyT85wJr-Qd93HRYAbUuMN%2BDmQUaQ%40mail.gmail.com.
