Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. - hosts: localhost
  2. gather_facts: False
  3.  
  4. vars:
  5. switches:
  6. - hostname: switch01.example.com
  7. - hostname: switch02.example.com
  8. subnets:
  9. general_use:
  10. subnet: 10.0.0.0/16
  11. specific_use:
  12. subnet: 10.1.0.0/24
  13. vlan: 100
  14.  
  15. vars_prompt:
  16. - name: "cisco_username"
  17. prompt: "Username"
  18. - name: "cisco_password"
  19. prompt: "Password"
  20. private: yes
  21.  
  22. tasks:
  23. - name: vLAN
  24. nxos_vlan:
  25. vlan_id: "{{ subnets[item[1]]['vlan'] }}"
  26. name: "{{ item[1] }}"
  27. host: "{{ item[0]['hostname'] }}"
  28. username: "{{ cisco_username }}"
  29. password: "{{ cisco_password }}"
  30. transport: nxapi
  31. use_ssl: yes
  32. with_nested:
  33. - "{{ switches}}"
  34. - "{{ subnets }}"
  35. when: "{{ subnets[item[1]]['vlan'] | default('skip') != 'skip' }}"
  36. delegate_to: 127.0.0.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement