Skip to content

Commit

Permalink
Add puppet user to user_groups if server or client certificate contai…
Browse files Browse the repository at this point in the history
…ns puppet path
  • Loading branch information
ehelms committed May 18, 2021
1 parent 3a6be45 commit afaf795
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
}

if $foreman::manage_user {
if $foreman::puppet_ssldir in $foreman::server_ssl_key or $foreman::puppet_ssldir in $foreman::client_ssl_key {
$_user_groups = $foreman::user_groups + ['puppet']
} else {
$_user_groups = $foreman::user_groups
}

group { $foreman::group:
ensure => 'present',
}
Expand All @@ -83,7 +89,7 @@
comment => 'Foreman',
home => $foreman::app_root,
gid => $foreman::group,
groups => $foreman::user_groups,
groups => unique($_user_groups),
}
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$manage_user = true
$user = 'foreman'
$group = 'foreman'
$user_groups = ['puppet']
$user_groups = []
$rails_env = 'production'
$version = 'present'
$plugin_version = 'present'
Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/hieradata/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ foreman::server_ssl_cert: /etc/foreman-certs/certificate.pem
foreman::server_ssl_chain: /etc/foreman-certs/certificate.pem
foreman::server_ssl_crl: ""
foreman::server_ssl_key: /etc/foreman-certs/key.pem
foreman::user_groups: []
foreman::client_ssl_ca: /etc/foreman-certs/certificate.pem
foreman::client_ssl_cert: /etc/foreman-certs/certificate.pem
foreman::client_ssl_key: /etc/foreman-certs/key.pem

0 comments on commit afaf795

Please sign in to comment.