paulbsd-salt/states/netboxinventory/init.sls

33 lines
1.3 KiB
Plaintext
Raw Normal View History

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')) == {} %}
2022-06-08 23:50:55 +02:00
"{{ salt['netbox.get'](app='dcim', endpoint='sites', name='nurnberg')}}"
"{{ salt['netbox.get'](app='dcim', endpoint='device-roles', name='front')}}"
2020-07-10 00:58:55 +02:00
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 %}