On 28. okt. 2016 18:56, Neil Watson wrote:
Greetings,

I'm trying to pass a data structure to a role, but it's not working out.
What have I done wrong?

main.yml:
---
- hosts: localhost
  vars:
    image:
      one:
        state: present
        path: /usr/src
  roles:
    - { role: test, image: "{{ image.one }}" }

roles/test/tasks/main.yml:
---
  - debug:
      msg: "state: {{ image.state }}, path: {{ image.path }}"

Expected results:

debug: state: present, path: /usr/src

First you define image in the vars section, and then you overwrite image with itself when you call the role, you can't do that.

--
Kai Stian Olstad

--
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8437d055-dfbf-8291-cc2d-da26ee46bc2a%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to