0

I have an Ansible role with a list of variables. In my playbook I need to change one item in that list. How can I pass just the single list item to the role rather than another list?

roles/updatexmlData/defaults/main.yml
---
xmldata:
  - field1: value1
  - field2: value2
  - field3: value3


playbook.yml
---
  hosts: xml-service-hosts
  vars:
    secret_field2_value: "field2: new_value"
  tasks:
    - name: Run updateXMLData Role
      include_role:
        name: updatexmlData
      vars:
        xmldata[1]: "{{ secret_field2_value }}"
Wanderer
  • 544
  • 1
  • 7
  • 23

0 Answers0