Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - hosts: localhost
- gather_facts: False
- vars:
- switches:
- - hostname: switch01.example.com
- - hostname: switch02.example.com
- subnets:
- general_use:
- subnet: 10.0.0.0/16
- specific_use:
- subnet: 10.1.0.0/24
- vlan: 100
- vars_prompt:
- - name: "cisco_username"
- prompt: "Username"
- - name: "cisco_password"
- prompt: "Password"
- private: yes
- tasks:
- - name: vLAN
- nxos_vlan:
- vlan_id: "{{ subnets[item[1]]['vlan'] }}"
- name: "{{ item[1] }}"
- host: "{{ item[0]['hostname'] }}"
- username: "{{ cisco_username }}"
- password: "{{ cisco_password }}"
- transport: nxapi
- use_ssl: yes
- with_nested:
- - "{{ switches}}"
- - "{{ subnets }}"
- when: "{{ subnets[item[1]]['vlan'] | default('skip') != 'skip' }}"
- delegate_to: 127.0.0.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement