--- # Switch configuration depends on the type of switch, so groups hosts by their # switch type and apply tasks/roles to the relevant groups. - name: Group hosts by their switch type hosts: switches gather_facts: no vars: # Set this variable to True to configure of network for hardware discovery. physical_network_enable_discovery: False tasks: - name: Group hosts by their switch type group_by: key: "switches_of_type_{{ switch_type }}" - name: Add discovery interface configuration when performing discovery set_fact: switch_interface_config: > {{ switch_interface_config | combine(switch_interface_config_discovery) }} when: "{{ physical_network_enable_discovery | bool }}" - name: Ensure DellOS physical switches are configured hosts: switches_of_type_dellos6:switches_of_type_dellos9 gather_facts: no roles: - role: ssh-known-host - role: dell-switch dell_switch_delegate_to: localhost dell_switch_type: "{{ switch_type }}" dell_switch_provider: "{{ switch_dellos_provider }}" dell_switch_config: "{{ switch_config }}" dell_switch_interface_config: "{{ switch_interface_config }}"