%PDF- %PDF-
| Direktori : /proc/self/root/proc/3522530/root/usr/lib/python2.7/site-packages/salt/pillar/ |
| Current File : //proc/self/root/proc/3522530/root/usr/lib/python2.7/site-packages/salt/pillar/netbox.pyc |
�
���^c @@ sf d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z e j
e � Z d � Z
d S( u�
A module that adds data to the Pillar structure from a NetBox API.
.. versionadded:: 2019.2.0
Configuring the NetBox ext_pillar
---------------------------------
.. code-block:: yaml
ext_pillar:
- netbox:
api_url: http://netbox_url.com/api/
api_token: 123abc
Create a token in your NetBox instance at
http://netbox_url.com/user/api-tokens/
The following options are optional, and determine whether or not
the module will attempt to configure the ``proxy`` pillar data for
use with the napalm proxy-minion:
.. code-block:: yaml
proxy_return: True
proxy_username: admin
By default, this module will query the NetBox API for the platform
associated with the device, and use the 'NAPALM driver' field to
set the napalm proxy-minion driver. (Currently only 'napalm' is supported
for drivertype.)
This module currently only supports the napalm proxy minion and assumes
you will use SSH keys to authenticate to the network device. If password
authentication is desired, it is recommended to create another ``proxy``
key in pillar_roots (or git_pillar) with just the ``passwd`` key and use
:py:func:`salt.renderers.gpg <salt.renderers.gpg>` to encrypt the value.
If any additional options for the proxy setup are needed they should also be
configured in pillar_roots.
Other available options:
site_details: ``True``
Whether should retrieve details of the site the device belongs to.
site_prefixes: ``True``
Whether should retrieve the prefixes of the site the device belongs to.
i ( t absolute_importt print_functiont unicode_literalsN( t ipaddressc O@ s2 | d k r t j d � i S| d j d � } | j d � } | j d t � } | j d t � } | j d d: � } | j d t � } i }
i } | r� i d
j | � d 6} n d j d
| d d d d � } t j j j
| d i | d 6d | d t �}
d |
k r6t j d | |
d � t j |
d � |
S|
d d } t | � d k rg| d |
d <n: t | � d k r�t j d | � |
St j d | � |
S|
d d d! } |
d d d } | rxt j
d"