Obvious for some, helpful for others, a more condensed version could look
like:
---
- name: SomePlaybook
hosts: yourgroup
roles:
- { role: yourrole, install_path: [ '/opt/install1', '/opt/install2'
] }
On Tuesday, 24 March 2015 00:03:22 UTC+1, Olivier Lauret wrote:
>
> Thank you George and Jonathan for your feedback,
>
> I like the idea of the roles in the playbook as the installation is a bit
> more complex than explained in the email. Thank you for the tip, I will try
> it write now :)
>
> Regards,
> Olivier
>
> On Monday, 23 March 2015 15:18:49 UTC-4, Jonathan Davila wrote:
>>
>> 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/31ce30e2-abe6-4cd9-8bec-c7bcdb8513bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.