Closed FragmentedPacket closed 6 years ago
It appears it is only failing due to an issue with the Python3.5 TravisCI test:
The command "python setup.py requirements -t" failed and exited with 1 during .
To-do:
@AAbouZaid Do you see this as a benefit? I've never worked on creating tests and want to make sure my code, etc. makes sense before I continue on and learn how to write the tests.
Since config contexts are new as of 2.4 I figured it'd be nice to be able to use those as host vars.
I'm not sure if this implementation is the best way so additional tweaks may be needed.
Overview
context:
underhosts_vars
in netbox.ymlhosts_vars: context: variable_name: config_context
context:
is configured underhosts_vars
it will gather the context data for a single device or all devicesSample data
./netbox.py --host switch2 {"ansible_ssh_host": "192.168.1.1", "serial": "awadawd21254", "asset-tag": "1001", "config_context": {"ntp2": "192.168.1.2", "ntp1": "192.168.1.1"}}
./netbox.py --list {"_meta": {"hostvars": {"switch1": {"serial": "cisco-serial", "asset_tag": "1234", "config_context": {"radius": {"radius03": "10.0.0.3", "radius02": "10.0.0.2", "radius01": "10.0.0.1"}, "tacacs": {"acs03": "10.0.0.3", "acs02": "10.0.0.2", "acs01": "10.0.0.1"}, "ntp-servers": {"ntp2": "192.168.1.2", "ntp1": "192.168.1.1"} "10": ["permit 10.0.0.0 0.0.0.255", "permit 172.16.0.0 0.0.255.255"]}} "switch2": {"ansible_ssh_host": "192.168.1.1", "serial": "awadawd21254", "asset-tag": "1001", "config_context": {"ntp2": "192.168.1.2", "ntp1": "192.168.1.1"}}, "group1": ["switch1"], "group2": ["switch2"]}