SaltStack Integration


Quickly and easily sync Salt Node information to Device42

Salt (aka SaltStack) is a Python-based open source configuration management software and remote execution engine. Salt supports the Software-Defined Datacenter, allowing configuration of your Infrastructure as Code (IaC). With the Device42 Salt Integration, you can now gather information about your devices from the same tool you use to provision them.
The Device42 / Salt Integration can gather the following from Salt:

  • Name
  • Node Type
  • CPU Power
  • Customer
  • Virtual or Physical
  • Virtual Sub-type
  • CPU Core Count
  • Manufacturer
  • Operating System & OS Version
  • Total Memory
  • HDD Count
  • Service Level

Assumptions & Pre-Requisites

Working Salt & Device42 installations. Tested against Salt Master 2016.11.1 Carbon
To allow connections, sign your minions certificate on your Salt Master and run the script on your Salt Master server

  • Python v2.7.x
  • PyYAML [$ easy_install pyyaml or $ pip install pyyaml]
  • appdirs [$ easy_install appdirs or $ pip install appdirs]
  • futures [$ easy_install futures or $ pip install futures]
  • jinja2 [$ easy_install jinja2 or $ pip install jinja2]
  • tornado [$ easy_install tornado or $ pip install tornado]
  • requests [$ easy_install requests or $ pip install requests]
  • salt [$ easy_install salt or $ pip install salt]
  • markupsafe [$ easy_install markupsafe or $ pip install markupsafe]
  • msgpack-python [$ easy_install msgpack-python or $ pip install msgpack-python]
  • packaging [$ easy_install packaging or $ pip install packaging]
  • pycrypto [$ easy_install pycrypto or $ pip install pycrypto]
  • pyparsing [$ easy_install pyparsing or $ pip install pyparsing]
  • pyzmq [$ easy_install pyzmq or $ pip install pyzmq]
  • singledispatch [$ easy_install singledispatch or $ pip install singledispath]
  • six [$ easy_install six or $ pip install six]

Configuration and Usage

  1. Create a working directory foo and copy the contents of the salt_to_device42_sync repository to it.
  2. Copy (or move/rename) the settings file settings.yaml.example to settings.yaml.
  3. Populate the settings.yaml file you created in the last step with your Device42 instance info [host, user, pss]:
# ========= Device 42
    host: host
    user: user
    pass: pass

# ========= Options
# static options
    customer: null
    customer_id: null
    service_level: null

    # as_node_name: one of [fqdn, name]
    as_node_name: fqdn
    node_filter: [] 

(consult README.MD & requirements.txt for more details)

  1. Configure node filtering, if desired. Details regarding configuration options can be found in Filter settings are added following the ‘options:’ section of settings.yaml.
  2. Run the script!
    $ python [-c /path/to/settings.yaml]

If you run into any unexpected behavior, bugs, or otherwise have questions, comments, or feature requests, feel free to reach out to [email protected]

Download the Salt integration script for Device42 today!