2020-07-10 00:58:55 +02:00
|
|
|
---
|
|
|
|
{%- from "netboxinventory/map.jinja" import netbox with context %}
|
|
|
|
netboxinventory_dependencies:
|
|
|
|
pip.installed:
|
|
|
|
- name: pynetbox
|
|
|
|
|
|
|
|
{%- if salt['netbox.get'](app='dcim', endpoint='sites', name=salt['grains.get']('location')) == {} %}
|
|
|
|
netbox.create_site_{{ salt['grains.get']('location') }}:
|
|
|
|
module.run:
|
|
|
|
- name: netbox.create_site
|
|
|
|
- site: {{ salt['grains.get']('location') }}
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
{%- if salt['netbox.get'](app='dcim', endpoint='device-roles', name=salt['grains.get']('type')) == {} %}
|
|
|
|
netbox.create_device_role_{{ salt['grains.get']('type') }}:
|
|
|
|
module.run:
|
|
|
|
- name: netbox.create_device_role
|
|
|
|
- role: {{ salt['grains.get']('type') }}
|
|
|
|
- color: "2196f3"
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
{%- if salt['netbox.get'](app='dcim', endpoint='devices', name=salt['grains.get']('nodename')) == {} %}
|
|
|
|
netbox.create_device_{{ salt['grains.get']('nodename')|to_camelcase }}:
|
|
|
|
module.run:
|
|
|
|
- name: netbox.create_device
|
|
|
|
- m_name: {{ salt['grains.get']('nodename') }}
|
|
|
|
- site: {{ salt['grains.get']('location') }}
|
|
|
|
- role: {{ salt['grains.get']('type') }}
|
|
|
|
- manufacturer: default
|
|
|
|
- model: default
|
2021-08-19 21:15:24 +02:00
|
|
|
{%- endif %}
|