Hi,
I want ot call the same role several time with different parameters in a 
playbook.
the variables I use are a dictionnary defined in group_vars.
I cannot use these variables defined in a group_vars file when listing 
roles in a playbook.
Is it a normal behaviour? How should I do in order to achieve it?
Thanks,
Regards.

group_vars/all
---
web_project:
  user: 'existinguser'
  repo: [email protected]:examplecom.git
  root: /var/www/virtualhosts/examplecom/

playbook.yml
---
# file: queueservers.yml
- name: Configure all MessageQueue servers
  hosts: queueservers
  sudo: yes
  roles:
    - { role: django, test: fakeuser', project: web_project }
 

roles/django/tasks/main.yml:
---
- name: test
  shell: 'echo foobar'
  sudo_user: "{{project.user}}"

--> It tries to execute the shell command as {{project.user}}'s user (in 
spite of 'existinguser').

and when I try with:

roles/django/tasks/main.yml:
---
- name: test
  shell: 'echo foobar'
  sudo_user: "{{test}}"

--> It tries to execute the shell command as 'fakeuser''s user, as expected.

The expected behaviour also happens when I use the following:

roles/django/tasks/main.yml:
---
- name: test
  shell: 'echo foobar'
  sudo_user: "{{web_project.user}}"



-- 
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/fa14bf67-ad3e-4c0f-8af6-a5b4f8e5e84f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to