puppet - Put contents of a file in a variable -
i have set values in file. in puppet manifests want value of these variables. there specific directory set file? also, should format of file?
if file on puppet-server, can write functions module. example:
modules/my_module/lib/puppet/parser/functions/get_var.rb: $: << file.expand_path(file.join(file.dirname(__file__), '.')) module puppet::parser::functions newfunction(:get_var, :type => :rvalue) |args| file_name = args[0] f = file.open(file_name) s = f.readline() homecoming s end end
and utilize in manifests: $test = get_var('/etc/puppet/configs.txt')
. function homecoming first string file, can alter needs. file on client, can write facter.
file puppet
No comments:
Post a Comment