daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Oct 19th, 2018 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---/home/bob/ansible-hosts-bob----- my inventory file
  2. [all:vars]
  3. ansible_connection=local
  4. ansible_python_interpreter=/home/bob/VENV/ansible/bin/python
  5. ansible_user=test
  6. ansible_ssh_pass=test
  7.  
  8. [local]
  9. localhost ansible_connection=local
  10.  
  11. [nxos_bob]
  12. nxos1_bob ansible_host=nxos1.com
  13. nxos2_bob ansible_host=nxos2.com
  14.  
  15.  --------------/home/bob/ansible_course/class3/exercises/group_vars/nxos_bob------- group_vars
  16.  
  17. provider_ssh:
  18.   host: "{{ ansible_host }}"
  19.   username: "{{ username }}"
  20.   password: "{{ password }}"
  21.   transport: cli
  22.  
  23. provider_nxapi:
  24.   host: "{{ ansible_host }}"
  25.   username: "{{ ansible_user }}"
  26.   password: "{{ ansible_ssh_pass }}"
  27.   transport: nxapi
  28.   use_ssl: yes
  29.   validate_certs: no
  30.   port: 8443
  31.  
  32. vlans_common:
  33.   - vlan_id: 301
  34.     admin_state: up
  35.     name: blue
  36.   - vlan_id: 302
  37.     admin_state: up
  38.     name: red
  39.   - vlan_id: 303
  40.     admin_state: up
  41.     name: green
  42.    
  43. vlans: "{{ vlans_common }} + {{ vlans_unique|default([]) }}"
  44.  
  45.  ------/home/bob/ansible_course/class3/exercises/host_vars/nxos1/vlans_bob.yml----- host_vars  
  46.  
  47.  vlans_unique:
  48.   - vlan_id: 304
  49.     admin_state: up
  50.     name: yellow
  51.  
  52.  
  53.  -------/home/bob/ansible_course/class3/exercises/-----
  54.  
  55. - name: Exercise1
  56.   hosts: nxos_bob
  57.   tasks:
  58.     - name: Configure NEXUS VLANs
  59.       nxos_vlan:
  60.         provider: "{{ provider_nxapi }}"
  61.         vlan_id: "{{ item.vlan_id }}"
  62.         name: "{{ item.name }}"
  63.       with_items: "{{ vlans }}"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top