da82044a84
Role renamed to junos-switch. Python dependencies are installed. Support for multiple configuration types, including 'set', 'text', and 'json'.
49 lines
1.7 KiB
YAML
49 lines
1.7 KiB
YAML
---
|
|
# 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 }}"
|
|
|
|
- name: Ensure Juniper physical switches are configured
|
|
hosts: switches_of_type_junos
|
|
gather_facts: no
|
|
roles:
|
|
- role: ssh-known-host
|
|
|
|
- role: junos-switch
|
|
junos_switch_delegate_to: localhost
|
|
junos_switch_venv: "{{ lookup('env', 'VIRTUAL_ENV') }}"
|
|
junos_switch_type: "{{ switch_type }}"
|
|
junos_switch_provider: "{{ switch_junos_provider }}"
|
|
junos_switch_config_format: "{{ switch_junos_config_format }}"
|
|
junos_switch_config: "{{ switch_config }}"
|
|
junos_switch_interface_config: "{{ switch_interface_config }}"
|