The shiftleader2-integration for puppet consists of multiple pieces:

Installation

Installing and configuring the puppet-integrations is quite simple:

# apt install shiftleader2-worker-puppet
# cp -n /etc/shiftleader2/workers.ini.example /etc/shiftleader2/workers.ini
# vim /etc/shiftleader2/workers.ini 
# cat /etc/shiftleader2/workers.ini 
[api]
location = https://api.shiftleader.<domain>
username = <sl2-username>
password = <secret-password>

The user for this worker need to have the 'puppet' role, and is created like so:

$ sl2 user create <sl2-username>
New password: 
Verify new password: 
User created:
+----------+--------------------------------------+
| Field    | Value                                |
+----------+--------------------------------------+
| id       | 8d5dbde3-5126-4fd4-aa98-4760c49901a3 |
| username | <sl2-username>                           |
+----------+--------------------------------------+
$ sl2 user add --role puppet <sl2-username>
Role puppet is added to <sl2-username>

Shiftleader also need to know about the puppetserver being installed:

$ sl2 puppetserver create puppetdemo.domain.fqdn Common
server is registered
+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| id             | 24d3306b-2275-4942-b4ca-146d08d33e4a |
| name           | puppetdemo.domain.fqdn               |
| resource-group | Common                               |
+----------------+--------------------------------------+

R10k integrations

The puppet and r10k integrations need to be run on a puppetserver host. And currently that is limited to Ubuntu 22.04 and puppet7 in our environment.

R10k installation

Start by installing puppetserver version 7 on a Ubuntu 22.04 server with the associated r10k:

# wget https://apt.puppet.com/puppet7-release-jammy.deb
# dpkg -i puppet7-release-jammy.deb
# apt update
# apt install puppet-agent puppetdb-termini puppetserver r10k

# The directory where the puppet binaries are installed is added to PATH during installation. login and logout before you proceed

# puppetserver ca setup --ca-name puppetca.<domain> --certname <fqdn-of-first-puppetserver>
# mkdir /etc/puppetlabs/r10k
# vim /etc/puppetlabs/r10k/r10k.yaml
# cat /etc/puppetlabs/r10k/r10k.yaml
---
pool_size: 4
deploy:
  generate_types: true
  exclude_spec: true
cachedir: "/opt/puppetlabs/puppet/cache/r10k"
sources:
  puppet:
    basedir: "/etc/puppetlabs/code/environments"
    remote: https://github.com/ntnusky/r10k.git


If r10k is installed correctly you should be able to deply an environment manually:

# r10k deploy environment pileit -pv

Environment discovery

With both r10k, puppetserver and the shiftleader2-worker-puppet installed enabling of the environment-discovery is simply starting the service:

root@puppetdemo:~# systemctl start shiftleader2-puppet-r10k-envupdate.service 
root@puppetdemo:~# journalctl -fu shiftleader2-puppet-r10k-envupdate.service
Feb 20 08:34:11 puppetdemo systemd[1]: Started Shiftleader2 Puppet r10k environment refresher.
Feb 20 08:34:11 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:11,808 - EnvRefreshWorker - INFO - Worker is started
Feb 20 08:34:13 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:13,638 - EnvRefreshWorker - INFO - Logged in to the API
Feb 20 08:34:18 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:18,967 - sl2worker.puppet.envrefresh - INFO - Registered the new environment bgpmerge
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,079 - sl2worker.puppet.envrefresh - INFO - Registered the new environment designatemonitoring
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,196 - sl2worker.puppet.envrefresh - INFO - Registered the new environment epoxy
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,314 - sl2worker.puppet.envrefresh - INFO - Registered the new environment fuglekikking
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,436 - sl2worker.puppet.envrefresh - INFO - Registered the new environment glance_epoxy
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,560 - sl2worker.puppet.envrefresh - INFO - Registered the new environment horizon_modstatus
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,686 - sl2worker.puppet.envrefresh - INFO - Registered the new environment hwraidfix
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,802 - sl2worker.puppet.envrefresh - INFO - Registered the new environment legacyc
Feb 20 08:34:19 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:19,926 - sl2worker.puppet.envrefresh - INFO - Registered the new environment lenovoefi
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,047 - sl2worker.puppet.envrefresh - INFO - Registered the new environment limits
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,164 - sl2worker.puppet.envrefresh - INFO - Registered the new environment master
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,285 - sl2worker.puppet.envrefresh - INFO - Registered the new environment pileit
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,399 - sl2worker.puppet.envrefresh - INFO - Registered the new environment production
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,513 - sl2worker.puppet.envrefresh - INFO - Registered the new environment quorumqueues
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,628 - sl2worker.puppet.envrefresh - INFO - Registered the new environment shiftleaderalias
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,743 - sl2worker.puppet.envrefresh - INFO - Registered the new environment skyhigh
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,852 - sl2worker.puppet.envrefresh - INFO - Registered the new environment skylow
Feb 20 08:34:20 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:20,965 - sl2worker.puppet.envrefresh - INFO - Registered the new environment snow
Feb 20 08:34:21 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:21,082 - sl2worker.puppet.envrefresh - INFO - Registered the new environment socstack
Feb 20 08:34:21 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:21,196 - sl2worker.puppet.envrefresh - INFO - Registered the new environment stackit
Feb 20 08:34:21 puppetdemo shiftleader2-r10k-envrefresh[34841]: 2026-02-20 08:34:21,311 - sl2worker.puppet.envrefresh - INFO - Registered the new environment zabbixvgpu

r10k deployment

Enabling the deployment-daemon is also just starting the service:

root@puppetdemo:~# systemctl start shiftleader2-puppet-r10k-downloader.service 
root@puppetdemo:~# journalctl -fu shiftleader2-puppet-r10k-downloader.service
Feb 20 08:48:10 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:48:10,097 - sl2worker.puppet.server - ERROR - Server is not registered in shiftleader.
Feb 20 08:48:10 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:48:10,097 - sl2worker.puppet.server - ERROR - Please register a puppet-server with the name 'puppetdemo.skyhigh.rothaugane.com'.

In this example the puppetserver is not yet registered in shiftleader (or its registered with a wrong name), and is thus unable to start properly. This is easily fixed by registering it correctly in shiftleader. If a deployment is started (either through the webinterface, or by using the CLI-client "sl2 environment deploy pileit") you can see the deployment being run in the logs:

root@puppetdemo:~# journalctl -fu shiftleader2-puppet-r10k-envupdate.service
Feb 20 08:52:08 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:08,012 - sl2worker.puppet.server - INFO - Starting checkout of the pileit environment
Feb 20 08:52:16 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:16,546 - sl2worker.puppet.server - INFO - Environment pileit is successfully deployed!
Feb 20 08:52:16 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:16,696 - sl2worker.puppet.server - INFO - Registered the deployment of pileit in SL!
Feb 20 08:52:16 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:16,994 - sl2worker.puppet.server - INFO - Registering module profile for env pileit in the API
Feb 20 08:52:32 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:32,015 - sl2worker.puppet.server - INFO - Registering module ntnuopenstack for env pileit in the API
 ....
Feb 20 08:52:32 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:32,599 - sl2worker.puppet.server - INFO - Registering the role base for the env pileit
Feb 20 08:52:34 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:34,594 - sl2worker.puppet.server - INFO - Registering the role puppet::db for the env pileit
Feb 20 08:52:34 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:34,739 - sl2worker.puppet.server - INFO - Registering the role puppet::ca for the env pileit
Feb 20 08:52:34 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:34,876 - sl2worker.puppet.server - INFO - Registering the role puppet::server for the env pileit
 ..... 
Feb 20 08:52:38 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:38,792 - sl2worker.puppet.server - INFO - Registering the role openstack::compute::ceph::vgpu for the env pileit
Feb 20 08:52:38 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:38,939 - sl2worker.puppet.server - INFO - Registering the role openstack::compute::local::vgpu for the env pileit
 .....
Feb 20 08:52:38 puppetdemo shiftleader2-r10k-downloader[34991]: 2026-02-20 08:52:38,939 - sl2worker.puppet.server - INFO - Registering puppet-types

The deployment registers the discovered roles in shiftleader.

Puppet ENC

Shiftleader serves as an "external node classifier" for puppetservers, and puppet can be configured to use shiftleader as an ENC by adding the following in /etc/puppetlabs/puppet/puppet.conf:

[master]
external_nodes = /usr/local/bin/shiftleader2-puppet-enc
node_terminus = exec

Puppet wil then call that script with the hostname of the puppet-agent needing configuration to get information of what classes/roles should be applied. The script can also be tested manually:

# shiftleader2-puppet-enc puppetdemo.infra.pile.it.ntnu.no
---
classes:
- role::base
environment: pileit
parameters:
  sl2:
    api: https://api.shiftleaderdemo.skyhigh.rothaugane.com
    server:
     ..... The rest of the sl2 client-data (available as the variable $::sl2 within puppet) is omitted .....

If no output, verify that the server exist and create it if missing

## To check if server exist
sl2 server list

## Create test server if not existing
sl2 server create --environment <environment : sl2 environment list> --role <role : sl2 role list> <server name> <servergroup : sl2 servergroup list> --domain <domain : sl2 domain list>

# From pileit 
sl2 server create --environment pileit --role base pileit PileIT-Management --domain infra.pile.it.ntnu.no


Puppet certificate monitor

On the puppetca-machine a certificate-monitor runs to register puppet certificates in shiftleader. This service is simply started like so:

# systemctl start shiftleader2-puppet-certmanager.service
# journalctl -fu shiftleader2-puppet-certmanager.service
Feb 20 09:31:34 puppetdemo systemd[1]: Started Shiftleader2 Puppet certificate manager.
Feb 20 09:31:34 puppetdemo shiftleader2-puppet-certmanager[35699]: 2026-02-20 09:31:34,707 - CertWorker - INFO - Worker is started
Feb 20 09:31:35 puppetdemo shiftleader2-puppet-certmanager[35699]: 2026-02-20 09:31:35,187 - CertWorker - INFO - Logged in to the API
Feb 20 09:31:35 puppetdemo shiftleader2-puppet-certmanager[35699]: 2026-02-20 09:31:35,560 - sl2worker.puppet.cert - INFO - Need to register the CA-Cert in the API
Feb 20 09:31:35 puppetdemo shiftleader2-puppet-certmanager[35699]: 2026-02-20 09:31:35,716 - sl2worker.puppet.cert - INFO - Registering the cert puppetdemo.infra.pile.it.ntnu.no (1) in the API

Puppet ca autosigner

Shiftleader is able to instruct the puppetca to automatically sign the certificate of freshly installed machines. If a certificate-request is recieved for a machine in the stat "PUPPET-SIGN", the puppetserver vil automatically sign the request, return tthe CA, and set the machine to the status "INSTALLED". To configure the puppetserver to use the autosign-feature you need to add the folloing to /etc/puppetlabs/puppet/puppet.conf:

[master]
autosign = /usr/local/bin/shiftleader2-puppet-autosign

That script should uses exit-codes to signal if signing is OK or not; and running it manually on a host in PUPPET-SIGN will set it to INSTALLED without signing the cert. So test it manually with caution (=: