-
-
Save jvanderaa/b5881c5fa778b0601f494d3b73259c23 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
- name: "TASK 100: NETBOX >> ADD DEVICE TO NETBOX" | |
netbox.netbox.netbox_device: | |
netbox_url: "{{ lookup('ENV', 'NETBOX_URL') }}" | |
netbox_token: "{{ lookup('ENV', 'NETBOX_API_KEY') }}" | |
data: | |
name: "{{ inventory_hostname }}" | |
device_type: "{{ ansible_facts['net_model'] }}" | |
platform: IOS # May be able to use a filter to define in future | |
serial: "{{ ansible_facts['net_serialnum'] }}" | |
status: Active | |
device_role: "{{ inventory_hostname | get_role_from_hostname }}" | |
site: “ANSIBLE_DEMO_SITE" | |
custom_fields: | |
code_version: "{{ ansible_facts['net_version'] }}" | |
- name: "TASK 110: NETBOX >> ADD INTERFACES TO NETBOX" | |
netbox.netbox.netbox_device_interface: | |
netbox_url: "{{ lookup('ENV', 'NETBOX_URL') }}" | |
netbox_token: "{{ lookup('ENV', 'NETBOX_API_KEY') }}" | |
data: | |
device: "{{ inventory_hostname }}" | |
name: "{{ item.key }}" | |
form_factor: "{{ item.key | get_interface_type }}" # Define types | |
mac_address: "{{ item.value.macaddress | ansible.netcommon.hwaddr }}" | |
state: present | |
with_dict: | |
- "{{ ansible_facts['net_interfaces'] }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment