|
| 1 | +--- |
| 2 | +- name: Create default device types |
| 3 | + networktocode.nautobot.device_type: |
| 4 | + url: "{{ nautobot_url }}" |
| 5 | + token: "{{ nautobot_token }}" |
| 6 | + model: "{{ device_type_item.model }}" |
| 7 | + manufacturer: "{{ device_type_item.manufacturer }}" |
| 8 | + u_height: "{{ device_type_item.u_height }}" |
| 9 | + is_full_depth: "{{ device_type_item.is_full_depth }}" |
| 10 | + part_number: "{{ device_type_item.part_number | default('') }}" |
| 11 | + comments: "{{ device_type_item.comments | default('') }}" |
| 12 | + subdevice_role: "parent" # need to set subdevice_role=parent to allow device bays to be attached |
| 13 | + state: present |
| 14 | + |
| 15 | +- name: Loop through interfaces and add them |
| 16 | + ansible.builtin.include_tasks: interfaces.yml |
| 17 | + loop: "{{ device_type_item.interfaces | default('[]') }}" |
| 18 | + loop_control: |
| 19 | + loop_var: interface_item |
| 20 | + |
| 21 | +- name: Loop through console ports and add them |
| 22 | + ansible.builtin.include_tasks: console_ports.yml |
| 23 | + loop: "{{ device_type_item['console-ports'] | default('[]') }}" |
| 24 | + loop_control: |
| 25 | + loop_var: console_port_item |
| 26 | + |
| 27 | +- name: Loop through module bays and add them |
| 28 | + ansible.builtin.include_tasks: module_bays.yml |
| 29 | + loop: "{{ device_type_item['module-bays'] | default('[]') }}" |
| 30 | + loop_control: |
| 31 | + loop_var: module_bay_item |
| 32 | + |
| 33 | +- name: Loop through power ports and add them |
| 34 | + ansible.builtin.include_tasks: power_ports.yml |
| 35 | + loop: "{{ device_type_item['power-ports'] | default('[]') }}" |
| 36 | + loop_control: |
| 37 | + loop_var: power_port_item |
0 commit comments