Skip to content
Antoine Delannoy edited this page Aug 19, 2020 · 2 revisions

Tutorials

The following example declares a netbox api data source and use it to fetch devices with tag "tor". This devices are then directly rendered using their name as an index and providing the loopback_v4 hostvar containing a dict with two keys: address and mask.

data_sources: # --------------------------------------------------------
  SrcA:
    type: netbox_api
    args:
      url: http://netbox.example.lan/
      token: e061.................................9b3

data_sets: # --------
  - name: final_devices
    from: source
    args:
      name: SrcA
      app: dcim
      type: devices
      filters:
        - tag: tor

render: # --------------------------------------------------------
  elements:
    - name: final_devices
      args:
        index:
          value: .name
        host_vars:
          loopback_v4: '.primary_ip4.address // "" | split("/") | {address: .[0], netmask: .[1]}'
          name: .name

Clone this wiki locally