Another method you could use is passing the variable value directly into 
the role when you call it as such


---
- name: SomePlaybook
  hosts: yourgroup
  roles:
        - {role: yourrole, install_path: '/opt/install1' }
        - {role: yourrole, install_path: '/opt/install2' }



On Monday, March 23, 2015 at 9:49:18 AM UTC-4, Olivier Lauret wrote:
>
> Hello all,
>
> I am new with ansible and trying to understand how, on the same server, to 
> run a role twice with different arguments.
>
> What I am trying to do is to install twice the same software but using a 
> different path.
>
> I have tried to use the host file like:
>
>    [grp1]
>    192.168.1.10
>
>    [grp2]
>    192.168.1.10
>
> and then set the group_vars like:
>
> group_vars/grp1:
>    ---
>    install_path = '/opt/install1' 
>
> group_vars/grp2:
>    ---
>    install_path = '/opt/install2'
>
> The problem is that my playbook always get "install_path = 
> '/opt/install1'" not matter if I only include only grp2.
>
> Any idea to solve this issue?
>
> Regards,
> Olivier
>

-- 
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/adc7f20a-86c2-4fb1-a48e-69b9b6d06f1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to