]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Don't create puppet group and user in postinstall-scripts/init-puppet
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 2 Nov 2023 10:09:56 +0000 (11:09 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 2 Nov 2023 10:09:56 +0000 (11:09 +0100)
postinstall-scripts/init-puppet

index ed7c11adfd29786920492915915da09c61e721c4..eec523cc6990e8d852ea10b8418f143bc41ace0b 100755 (executable)
@@ -417,7 +417,7 @@ check_group_and_user() {
         info "Group 'puppet' is already existing, GID=$(id -g puppet)."
     else
         info "Creating group 'puppet' ..."
-        cmd="groupadd -g 63000 puppet"
+        cmd="groupadd --system puppet"
         debug "Executing: ${cmd}"
         eval ${cmd}
     fi
@@ -427,7 +427,10 @@ check_group_and_user() {
         info "User 'puppet' is already existing, UID=$(id -u puppet)."
     else
         info "Creating user 'puppet' ..."
-        cmd="useradd -u 63000 -g puppet -d /var/lib/puppet -c \"Puppet configuration management\" -s /sbin/nologin puppet"
+        cmd="useradd --system --gid puppet "
+        cmd+="--home-dir \"/var/lib/puppet\" --create-home "
+        cmd+="--comment \"Puppet configuration management\" "
+        cmd+="--shell \"/sbin/nologin\" puppet"
         debug "Executing: ${cmd}"
         eval ${cmd}
     fi
@@ -494,7 +497,7 @@ generate_facts() {
     local facts_dir="/etc/puppetlabs/facter/facts.d"
     if [[ ! -d "${facts_dir}" ]] ; then
         info "Creating '${GREEN}${facts_dir}${NORMAL}' ..."
-        MKDIR "${facts_dir}"
+        MKDIR --parents "${facts_dir}"
     fi
 
     local yfile="${facts_dir}/customer.yaml"
@@ -611,7 +614,7 @@ main() {
     empty_line
 
     check_os
-    check_group_and_user
+    check_group_and_user
     check_installed_rpm
 
     generate_puppetconf