fix: manage git user #339

Merged
unkinben merged 1 commits from benvin/git_user into develop 2025-07-06 11:27:35 +10:00
3 changed files with 31 additions and 3 deletions
Showing only changes of commit 61e2d804ec - Show all commits

View File

@ -2,6 +2,7 @@
hiera_include: hiera_include:
- profiles::sql::postgresdb - profiles::sql::postgresdb
- profiles::nginx::simpleproxy - profiles::nginx::simpleproxy
- profiles::gitea::user
- gitea - gitea
# additional altnames # additional altnames
@ -36,6 +37,9 @@ profiles::consul::client::node_rules:
segment: git segment: git
disposition: write disposition: write
# manage the gitea user
profiles::gitea::user::manage: true
# manage a simple nginx reverse proxy # manage a simple nginx reverse proxy
profiles::nginx::simpleproxy::nginx_vhost: 'git.query.consul' profiles::nginx::simpleproxy::nginx_vhost: 'git.query.consul'
profiles::nginx::simpleproxy::nginx_aliases: profiles::nginx::simpleproxy::nginx_aliases:
@ -55,6 +59,9 @@ profiles::sql::postgresdb::dbuser: gitea
gitea::ensure: '1.22.4' gitea::ensure: '1.22.4'
gitea::checksum: 'd549104f55067e6fb156e7ba060c9af488f36e12d5e747db7563fcc99eaf8532' gitea::checksum: 'd549104f55067e6fb156e7ba060c9af488f36e12d5e747db7563fcc99eaf8532'
gitea::manage_user: false
gitea::manage_group: false
gitea::manage_home: false
gitea::custom_configuration: gitea::custom_configuration:
'': '':
APP_NAME: 'Gitea' APP_NAME: 'Gitea'

View File

@ -12,8 +12,8 @@ define profiles::base::account (
Boolean $ignore_pass = false, Boolean $ignore_pass = false,
Array[String] $groups = [], Array[String] $groups = [],
Array[String] $sshkeys = [], Array[String] $sshkeys = [],
Array[String] $sudo_rules = [],
String $shell = '/usr/bin/bash', String $shell = '/usr/bin/bash',
Optional[Array[String]] $sudo_rules = undef,
) { ) {
# Set gid to uid if gid is undef # Set gid to uid if gid is undef
@ -39,7 +39,9 @@ define profiles::base::account (
} }
# Manage sudo rules # Manage sudo rules
sudo::conf { "${username}_sudo": if $sudo_rules {
content => $sudo_rules, sudo::conf { "${username}_sudo":
content => $sudo_rules,
}
} }
} }

View File

@ -0,0 +1,19 @@
# creates gitea service user
class profiles::gitea::user (
Boolean $manage = false,
String $user = 'git',
String $group = 'git',
Integer $uid = 1101,
Integer $gid = 1101,
) {
if $manage {
profiles::base::account {'git':
username => 'git',
uid => $uid,
gid => $gid,
system => false,
before => Class['gitea'],
}
}
}