Files

110 lines
3.0 KiB
ObjectPascal
Raw Permalink Normal View History

## confdroid_puppet::main::files.pp
# Module name: confdroid_puppet
2025-02-26 01:55:17 +01:00
# Author: Arne Teuke (arne_teuke@confdroid)
# @summary Class manages config files for the confdroid_puppet module.
2025-02-26 01:55:17 +01:00
###############################################################################
class confdroid_puppet::main::files (
2025-02-26 01:55:17 +01:00
) inherits confdroid_puppet::params {
require confdroid_puppet::main::dirs
2025-02-26 21:13:33 +01:00
if $fqdn != $pt_pm_fqdn {
file { $pt_puppet_conf_file:
ensure => file,
path => $pt_puppet_conf_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_puppet_conf_erb),
notify => Service[$pt_agent_service],
2025-02-26 21:13:33 +01:00
}
if $pt_use_puppetdb == true {
file { $pt_node_rb_file:
ensure => file,
owner => 'root',
group => 'root',
mode => '0550',
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_node_rb_erb),
}
}
if $pt_use_puppetdb != true {
file { $pt_node_rb_file:
2025-11-26 19:23:00 +01:00
ensure => absent,
}
}
2025-02-26 21:13:33 +01:00
}
if $fqdn == $pt_pm_fqdn {
file { $pt_puppet_conf_file:
ensure => file,
path => $pt_puppet_conf_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_puppet_conf_erb),
notify => Service[$pt_agent_service,$pt_server_service],
2025-02-26 21:13:33 +01:00
}
if $pt_use_puppetdb == true {
# puppetdb
file { $pt_puppetdb_conf_file:
ensure => file,
path => $pt_puppetdb_conf_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_puppetdb_conf_erb),
notify => Service[$pt_agent_service,$pt_server_service],
}
# routes.yaml
file { $pt_routes_file:
ensure => file,
path => $pt_routes_file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_routes_erb),
notify => Service[$pt_server_service],
}
file { $pt_node_rb_file:
ensure => file,
owner => 'puppet',
group => 'puppet',
mode => '0550',
selrange => s0,
selrole => object_r,
seltype => foreman_enc_t,
seluser => system_u,
content => template($pt_node_rb_erb),
}
}
if $pt_use_puppetdb != true {
file { $pt_puppetdb_conf_file:
2025-11-26 19:23:00 +01:00
ensure => absent,
}
file { $pt_routes_file:
2025-11-26 19:23:00 +01:00
ensure => absent,
}
}
2025-02-26 21:13:33 +01:00
}
2025-02-26 01:55:17 +01:00
}