# 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', } # facts to create $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], } } }