0

I have a xml file with passwords in it. I have to pass these passwords from a xml file to password property in MSBUILD command. Can anyone guide me

Xml:

<?xml versio------>
<configuration>
<password>newpassword</password>
</configuration>

My msbuild command is:

Msbuild "projectpath" /p:deployonbuild=true /p:username='user's /p:password=' '
0

There is a xml module in https://docs.ansible.com/ansible/latest/collections/community/general/xml_module.html and there is an example to retrieve a xml value from an XML file

# Consider the following XML file:
#
# <business type="bar">
#   <name>Tasty Beverage Co.</name>
#     <beers>
#       <beer>Rochefort 10</beer>
#       <beer>St. Bernardus Abbot 12</beer>
#       <beer>Schlitz</beer>
#    </beers>
#   <rating subjective="true">10</rating>
#   <website>
#     <mobilefriendly/>
#     <address>http://tastybeverageco.com</address>
#   </website>
# </business>

# Retrieve and display the number of nodes
- name: Get count of 'beers' nodes
  community.general.xml:
    path: /foo/bar.xml
    xpath: /business/beers/beer
    count: yes
  register: hits

- ansible.builtin.debug:
    var: hits.count

# ...

# How to read an attribute value and access it in Ansible
- name: Read an element's attribute values
  xml:
    path: /foo/bar.xml
    xpath: /business/website/validxhtml
    content: attribute
  register: xmlresp

- name: Show an attribute value
  debug:
    var: xmlresp.matches[0].validxhtml.validatedon

You can adopt that for your needs. In Ansible 2.9 use xml instead of community.general.xml and be aware of installing the necessary libs (lxml)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.