StackStorm-Exchange / stackstorm-ansible

st2 content pack containing ansible integrations
https://exchange.stackstorm.org/
Apache License 2.0
36 stars 28 forks source link

support json in extra_vars #6

Closed cognifloyd closed 7 years ago

cognifloyd commented 7 years ago

If I'm reading this right, ansible.playbook doesn't support anything other than files and var=value definitions, not inline yaml or inline json, right?

According to the ansible docs, --extra-vars supports inline json (>=v1.2) and inline yaml (>=v1.3). (of course json is yaml, so only bother with json). Could this be enhanced to support that as well?

I'm using a playbook in an action chain, and I would like to pass in yaml like this:

---
chain:
  -
    name: "my_great_action_chain_action"
    ref: "ansible.playbook"
    parameters:
      playbook: "playbooks/cool.yaml"
      extra_vars:
        -
          important_var_name:
            - { name: '{{ var_from_earlier_action }}', otherkey: '{{ var_from_earlier_action }}' }

This would approximate how I would add the vars if I added them directly to the playbook under vars.