feat: moved enc_role and enc_env to ruby facts

This commit is contained in:
2024-04-24 23:30:27 +10:00
parent df05be21f6
commit e0dbecbfa0
4 changed files with 48 additions and 9 deletions
+19 -9
View File
@@ -12,18 +12,28 @@ class profiles::base::facts {
mode => '0755',
}
# facts to create
# cleanup old facts files
$fact_list = [ 'enc_role', 'enc_env' ]
# Manage the external fact file with content from the template
$fact_list.each | String $item | {
file { "${facts_d_path}/${item}.txt":
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => template("profiles/base/facts/${item}.erb"),
require => File[$facts_d_path],
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 => absent,
owner => 'root',
group => 'root',
mode => '0644',
content => template('profiles/base/facts/custom_facts.yaml.erb'),
}
}
@@ -0,0 +1,3 @@
---
enc_role: <%= @enc_role[0] %>
enc_env: <%= @enc_env %>