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}}”
multiple blocks with the when: keyword?
-
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.
OK, but have 10 network?
This network interface number is dynamic. The one interface is TRUE, more ins FALSE
Ok, the first interface TRUE and 0> is false.
How to with_sequence: start=1 end=“networkinterface_number - 1”