podmanrunner/manifests/runner.pp

51 lines
1.2 KiB
Puppet

# 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 => '0600',
}
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 => '500',
source => 'puppet:///modules/podmanrunner/podman-compose',
owner => "${username}${x}",
group => "${username}${x}",
}
}
}