- name: Create Primary network interface
azure_rm_networkinterface:
name: "interface{{item}}"
resource_group: my_resource
virtual_network_name: my_virtual_network_name
subnet_name: my_subnet
ip_configurations:
- name: ipconfig{{item}}
public_ip_address_name: "{{ get_ip_public.state.name }}"
primary: True
with_sequence: start=0 end=0

- name: Create Additional network interface
azure_rm_networkinterface:
name: "interface{{item}}"
resource_group: my_resource
virtual_network_name: my_virtual_network_name
subnet_name: my_subnet
ip_configurations:
- name: ipconfig{{item}}
public_ip_address_name: "{{ get_ip_public.state.name }}"
primary: False
with_sequence: start=1 end=networkinterface_number


Would be my suggestion, it looks like it'd need some work around the IP
address assignments.

On Mon, 4 Feb 2019 at 12:10, Rafael Tomelin <[email protected]>
wrote:

> Hi Keif,
>
> I need this example:
>
> ---
> - hosts: localhost
>   vars:
>     networkinterface_number: 5
>
>   tasks:
>       - debug: "msg='network {{ myvar }} '"
>         vars:
>           myvar: "{{ 'True' if ( item == 1) else 'False' }}"
>         with_sequence: count="{{networkinterface_number}}"
>
> But, myvar not replace in loop with_sequence.
>
>
>
> On Mon, Feb 4, 2019 at 8:55 AM Keif Gwinn <[email protected]> wrote:
>
>> multiple blocks with the when: keyword?
>>
>> On Fri, 1 Feb 2019 at 19:37, Rafael Tomelin <[email protected]>
>> wrote:
>>
>>> Hi,
>>>
>>> How defined variable value when other variable for different the 1.
>>>
>>> Exemplo
>>>
>>> vars:
>>>   networkinterface_number: 1
>>>
>>> - name: Create network interface
>>>   azure_rm_networkinterface:
>>>     name: "interface{{networkinterface_number}}"
>>>     resource_group: my_resource
>>>     virtual_network_name: my_virtual_network_name
>>>     subnet_name: my_subnet
>>>     ip_configurations:
>>>       - name: ipconfig1
>>>         public_ip_address_name: "{{ get_ip_public.state.name }}"
>>>         primary: True * # if "{{networkinterface_number}}" for equal 1
>>> primary True else False*
>>>   with_sequence: count=3 #"{{networkinterface_number}}"
>>>
>>> --
>>> Atenciosamente,
>>>
>>> Rafael Tomelin
>>> Tel.: 51-84104084
>>> Skype: rafael.tomelin
>>>
>>> LPI ID: LPI000191271
>>>
>>> --
>>> 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/CAGEUqbCOC35%3DisWmP65ZJ9kMpjgXNVJSV5uLCmS2RocVr00cqQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAGEUqbCOC35%3DisWmP65ZJ9kMpjgXNVJSV5uLCmS2RocVr00cqQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Keif Gwinn
>>
>> --
>> 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/CAMTXzjXJK5V%2BvtN%3DKJf1j6AssCtCj2Q1f-%3DSxj%2Bk1paYg058JA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAMTXzjXJK5V%2BvtN%3DKJf1j6AssCtCj2Q1f-%3DSxj%2Bk1paYg058JA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Atenciosamente,
>
> Rafael Tomelin
> Tel.: 51-84104084
> Skype: rafael.tomelin
>
> LPI ID: LPI000191271
>
> --
> 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/CAGEUqbBeG%3D--NQkpm07Qcq8RPozLPX9mh5z-4hT1m9j9CXKTTA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGEUqbBeG%3D--NQkpm07Qcq8RPozLPX9mh5z-4hT1m9j9CXKTTA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Keif Gwinn

-- 
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/CAMTXzjXte85%3DaDHsPUgLqfS6BX466nx%3DDfjTD_a%2BBRy8oYHhXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to