feat: change enc_* fact to read direct from cobbler (#219)

- change enc_role and enc_env to read direct from cobbler
- cleanup profiles::base::facts

Reviewed-on: https://git.query.consul/unkinben/puppet-prod/pulls/219
This commit was merged in pull request #219.
This commit is contained in:
2025-03-12 23:09:15 +11:00
parent b981a6fb01
commit 8eb751e22f
10 changed files with 80 additions and 73 deletions
-1
View File
@@ -22,7 +22,6 @@ class profiles::base (
# include the base profiles
include profiles::base::repos
include profiles::packages
include profiles::base::facts
include profiles::base::motd
include profiles::base::scripts
include profiles::base::hosts
-39
View File
@@ -1,39 +0,0 @@
# a class to define some global facts
class profiles::base::facts {
# The path where external facts are stored
$facts_d_path = '/opt/puppetlabs/facter/facts.d'
# Ensure the directory exists
file { $facts_d_path:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
# cleanup old facts files
$fact_list = [ 'enc_role', 'enc_env' ]
$fact_list.each | String $item | {
file { "${facts_d_path}/${item}.txt":
ensure => absent,
}
}
# ensure the path to the custom store exists
file { '/root/.cache':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0750',
}
# create the file that will be read
file { '/root/.cache/custom_facts.yaml':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => template('profiles/base/facts/custom_facts.yaml.erb'),
}
}
+1 -2
View File
@@ -8,8 +8,7 @@ class profiles::firstrun::init {
include profiles::base::repos
include profiles::firstrun::packages
# set the motd and base facts
include profiles::base::facts
# set the motd
include profiles::base::motd
# create the sysadmin account
@@ -1,3 +0,0 @@
---
enc_role: <%= @enc_role[0] %>
enc_env: <%= @enc_env %>
@@ -1 +0,0 @@
enc_env=<%= @enc_env %>
@@ -1 +0,0 @@
enc_role=<%= @enc_role[0] %>