Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---/home/bob/ansible-hosts-bob----- my inventory file
- [all:vars]
- ansible_connection=local
- ansible_python_interpreter=/home/bob/VENV/ansible/bin/python
- ansible_user=test
- ansible_ssh_pass=test
- [local]
- localhost ansible_connection=local
- [nxos_bob]
- nxos1_bob ansible_host=nxos1.com
- nxos2_bob ansible_host=nxos2.com
- --------------/home/bob/ansible_course/class3/exercises/group_vars/nxos_bob------- group_vars
- provider_ssh:
- host: "{{ ansible_host }}"
- username: "{{ username }}"
- password: "{{ password }}"
- transport: cli
- provider_nxapi:
- host: "{{ ansible_host }}"
- username: "{{ ansible_user }}"
- password: "{{ ansible_ssh_pass }}"
- transport: nxapi
- use_ssl: yes
- validate_certs: no
- port: 8443
- vlans_common:
- - vlan_id: 301
- admin_state: up
- name: blue
- - vlan_id: 302
- admin_state: up
- name: red
- - vlan_id: 303
- admin_state: up
- name: green
- vlans: "{{ vlans_common }} + {{ vlans_unique|default([]) }}"
- ------/home/bob/ansible_course/class3/exercises/host_vars/nxos1/vlans_bob.yml----- host_vars
- vlans_unique:
- - vlan_id: 304
- admin_state: up
- name: yellow
- -------/home/bob/ansible_course/class3/exercises/-----
- - name: Exercise1
- hosts: nxos_bob
- tasks:
- - name: Configure NEXUS VLANs
- nxos_vlan:
- provider: "{{ provider_nxapi }}"
- vlan_id: "{{ item.vlan_id }}"
- name: "{{ item.name }}"
- with_items: "{{ vlans }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement