Hi Andrew

Thanks for the tip, it was spot on.

I created the group_vars directory and the qfx.yml file that looks like 
this:







*qfx:  qfx01:    - {'name': 'xe-0/0/40', 'description': 
'eth0-VMHOST-TESTE'}    - {'ae': 'ae45', 'members': 'xe-0/0/40'}  qfx2:    
- {'name': 'xe-0/0/40', 'description': 'eth1-VMHOST-TESTE'}*

And my tasks were like this, executing the generated loop and with a 
conditional in the execution




















*- name: Configurando interfaces nos switches  
junipernetworks.junos.junos_interfaces:    config:      - name: "{{ 
item.name }}"        description: "{{ item.description }}"  loop: "{{ 
qfx[inventory_hostname] }}"  when: item.name is defined  tags:  - 
loop-interface- name: Configurando interfaces ae's nas interfaces dos 
switches  junipernetworks.junos.junos_lag_interfaces:    config:      - 
name: "{{ item.ae }}"        members:        - member: "{{ item.members 
}}"  loop: "{{ qfx[inventory_hostname] }}"  when: item.ae is defined  
tags:  - loop-ae*

Again, thank you very much.
Em terça-feira, 13 de junho de 2023 às 18:04:36 UTC-3, Andrew Latham 
escreveu:

> Away from my lab but knee-jerk is that group-vars should allow you to 
> organize that information.
>
> On Tue, Jun 13, 2023 at 1:38 PM Cristian Cardoso <[email protected]> 
> wrote:
>
>> I'm using ansible to configure ports on my Juniper switches where I use 
>> LACP to configure an aggregation of ports from a server on two different 
>> switches, where eth0 will be connected to switch 01 and eth1 to switch 02
>>
>> I created a template for configuring the interfaces, which follows below:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *interfaces {    xe-0/0/{{ id_interface }} {        description "{{ 
>> interface_descricao }}";        ether-options {            802.3ad ae{{ 
>> id_ae_interface }};        }    }}*
>>
>> Inside the main.yml file that is in the vars directory, I insert the 
>> variables to populate the fields
>>
>>
>>
>>
>> *interface_id: 30id_ae_interface: 23interface_description: eth0-VMHOST422*
>>
>> Here comes my question/problem, as I mentioned before, I need to 
>> configure the eth0 port and the eth1 port, where the eth0 port goes on 
>> switch 01 and the eth1 port on switch 02, is there any way to make it 
>> possible to populate the variables with eth0 and eth1 port in just one run?
>>
>> Or if anyone has experienced this and solved it in some other way, I 
>> would be grateful for the help.
>>
>>
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/1121d4b8-d922-4c98-a835-961cf7fb227an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/1121d4b8-d922-4c98-a835-961cf7fb227an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> - Andrew "lathama" Latham -
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/957aa547-3aa9-4232-89d4-21228084b08fn%40googlegroups.com.

Reply via email to