add user control

This commit is contained in:
Arne Teuke
2025-03-10 15:13:46 +01:00
parent b29f4e7db1
commit ad4b68911f
3 changed files with 35 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ class alloy_cd::main::service (
) inherits alloy_cd::params {
require alloy_cd::main::files
require alloy_cd::main::user
service { $ay_service:
ensure => running,

24
manifests/main/user.pp Normal file
View File

@@ -0,0 +1,24 @@
## alloy_cd::main::user.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages the alloy user
###############################################################################
class alloy_cd::main::user (
) inherits alloy_cd::params {
if $ay_manage_user == true {
user { $ay_user:
ensure => present,
name => $ay_user,
allowdupe => false,
groups => $ay_groups,
managehome => false,
shell => $ay_user_shell,
}
group { $ay_user:
ensure => present,
allowdupe => false,
}
}
}

View File

@@ -10,6 +10,10 @@
# @param [boolean] ay_manage_prom whether to manage metric forwarding
# @param [string] ay_prom_url the url where alloy will send metrics
# @param [array] ay_log_targets the logging targets
# @param [boolean] ay_manage_user whether to manage user settings
# @param [string] ay_user the alloy user name
# @param [array] ay_groups which groups the user should be in
# @param [string] ay_user_shell which shell to use
# @summary Class contains all parameters for the alloy_cd module.
##############################################################################
class alloy_cd::params (
@@ -28,6 +32,12 @@ class alloy_cd::params (
Boolean $ay_manage_prom = true,
String $ay_prom_url = 'https://prometheus.example.net/api/v1/write',
# user
Boolean $ay_manage_user = true,
String $ay_user = 'alloy',
Array $ay_groups = ['wheel','adm'],
String $ay_user_shell = '/sbin/nologin',
) {
# service
$ay_service = 'alloy'