Puppet Nodes

Feed Rundeck with open source Puppet nodes. This Python script lets you customize the facts exposed to Rundeck, which you can then query with the Node selector.

Puppet Rundeck

Feed Rundeck with Puppet nodes.

This Python script reads into the Puppet Master filesystem and produces a yaml file containing up-to-date nodes information. The nodes description is based on Puppet facts and reads from the yaml node reports written by puppet. The output file respects Rundeck resource yaml format. Facts (custom or not) can be added at will, and are then available in Rundeck Node Filter.

The final yaml file should be exposed to an internal address, used as a URL Source in Rundeck Project Nodes configuration.


  • Python 3


This script should run on the Puppet Master and have read access to puppet directories.

cp conf/conf_example.yaml conf/conf.yaml
./puppet_to_rundeck.py [OPTIONS]


Name Description Default
-o, --outfile Required: output yaml file
-i, --inputdir input directory containg puppet nodes yaml files /var/lib/puppet/yaml/node
-m, --maxage max age of input node files (days) 7


The file conf/conf.yaml should be copied from conf/conf_example.yaml and adapted. Sections:

  • tmp_file: the temporary file where the script will write before replacing the output file with its new version
  • yamlstruct: the yaml block describing each node. It should be formatted in this way:
  node_name: yournodename
    key1: value1
    key2: value2
    key3: value3

where yournodename is the title of your yaml block. The node_name entry is mandatory. keyN is an optionnal entry, like a fact you want to access via Rundeck Node Filter.

  • tags_list: is a list of tags, which are used in Rundeck for node filtering. The tag list is a subset of {key1, key2,...,keyN}.

If you need to add a few nodes not managed by Puppet, you can describe them in the file conf/other_nodes.yaml, following the example file conf/other_nodes_example.yaml.


Assuming your configuration file conf/conf.yaml is the following:

tmp_file: /tmp/tmpfile.yaml
  - lsbdistcodename
  - customfact

  node_name: parameters.hostname
    hostname: name
    osFamily: parameters.osfamily
    osVersion: parameters.os.release.full
    osName: parameters.os.lsb.distdescription
    osArch: parameters.architecture
    lsbdistcodename: parameters.lsbdistcodename
    customfact: parameters.mycustomfact

and the script reads from puppet node directory (/var/lib/puppet/yaml/node by default) the file mynode.yaml which contains:

name: mynode
  hostname: example_node
  osfamily: Debian
      full: '9.4'
      distdescription: Debian GNU/Linux 9.4 (stretch)
  architecture: amd64
  lsbdistcodename: stretch
  mycustomfact: mycustomvalue

the output block describing this node will read:

  hostname: mynode
  osFamily: Debian
  osVersion: '9.4'
  osName: Debian GNU/Linux 9.4 (stretch)
  osArch: amd64
  lsbdistcodename: stretch
  customfact: mycustomvalue
  tags: stretch, mycustomvalue

Each of the fields of the output block can be queried by Rundeck Node Filter.