# Class for forgeo action runner. class podmanrunner::runner ( Integer $replicas = 2, ) { $username='runneruser' package { 'podman': ensure => installed, provider => apt, } package { 'systemd-container': ensure => installed, provider => apt, } range(1,$replicas).each |$x| { user { "${username}${x}": ensure => present, home => "/opt/${username}${x}", shell => '/usr/sbin/nologin', uid => "${ $x + 1001}", managehome => true, } file { "/opt/${username}${x}/docker-compose.yaml": ensure => file, content => template('podmanrunner/docker-compose.yaml.erb'), owner => "${username}${x}", group => "${username}${x}", mode => '0400', } file { "/opt/${username}${x}/bin": ensure => directory, mode => '0700', owner => "${username}${x}", group => "${username}${x}", } file { "/opt/${username}${x}/bin/podman-compose": ensure => file, mode => '0500', source => 'puppet:///modules/podmanrunner/podman-compose', owner => "${username}${x}", group => "${username}${x}", } file { "/opt/${username}${x}/runnerimage": ensure => directory, mode => '0700', owner => "${username}${x}", group => "${username}${x}", } file { "/opt/${username}${x}/runnerimage/Containerfile": ensure => file, content => template('podmanrunner/runnerimage-Containerfile.erb'), owner => "${username}${x}", group => "${username}${x}", mode => '0400', } exec { "enable-${username}${x}-linger": command => "loginctl enable-linger ${username}${x}", path => '/usr/bin:/usr/sbin:/bin', provider => shell, logoutput => false, unless => "test -f /var/lib/systemd/linger/${username}${x}", } } }