Created
April 20, 2023 15:30
-
-
Save zeitounator/d200ea94e33ce7a39e653b692f3b7373 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tree | |
. | |
├── inventories | |
│ └── demo | |
│ ├── hosts | |
│ └── host_vars | |
│ ├── CEASF-RTR.yml | |
│ └── cowfm-311-core.yml | |
└── playbook.yml | |
3 directories, 4 files | |
$ cat inventories/demo/hosts | |
[CEASF] | |
CEASF-RTR | |
[CO311CORE] | |
cowfm-311-core | |
[ios:children] | |
CEASF | |
CO311CORE | |
$ cat inventories/demo/host_vars/CEASF-RTR.yml | |
--- | |
wired_dhcp_interfaces: | |
- "GigabitEthernet0/0.1" | |
- "GigabitEthernet0/0.4" | |
- "GigabitEthernet0/0.5" | |
$ cat inventories/demo/host_vars/cowfm-311-core.yml | |
--- | |
wired_dhcp_interfaces: | |
- "Vlan1" | |
- "Vlan98" | |
- "Vlan100" | |
- "Vlan102" | |
- "Vlan104" | |
$ cat playbook.yml | |
--- | |
- hosts: ios | |
gather_facts: false | |
tasks: | |
- debug: | |
var: wired_dhcp_interfaces | |
$ ansible-playbook -i inventories/demo/ playbook.yml | |
PLAY [ios] ********************************************************************************************************************************* | |
TASK [debug] ******************************************************************************************************************************* | |
ok: [CEASF-RTR] => { | |
"wired_dhcp_interfaces": [ | |
"GigabitEthernet0/0.1", | |
"GigabitEthernet0/0.4", | |
"GigabitEthernet0/0.5" | |
] | |
} | |
ok: [cowfm-311-core] => { | |
"wired_dhcp_interfaces": [ | |
"Vlan1", | |
"Vlan98", | |
"Vlan100", | |
"Vlan102", | |
"Vlan104" | |
] | |
} | |
PLAY RECAP ********************************************************************************************************************************* | |
CEASF-RTR : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 | |
cowfm-311-core : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment