On 01/19/2012 10:52 PM, no-re...@cfengine.com wrote: > Forum: CFEngine Help > Subject: Dealing with vars changing > Author: jonesy1234 > Link to topic: https://cfengine.com/forum/read.php?3,24603,24603#msg-24603 > > I have a setup that requires a slightly different value for a var depending a > class. For example most of my systems run standard AIX syslog, two run > syslog-ng. The following code works ok but is there a better way of dealing > with situations like this? > > > > bundle agent manage_core_services { > > vars: > > "service" slist => { "ntp", "ssh", "syslog", "inetd" }; > > methods: > > "any" usebundle => fix_service("$(service)"), > comment => "Make sure the basic application services are > running"; > > } > > ####################################################################### > bundle agent fix_service(service) { > > vars: > > #NTP > "daemon" string => "xntpd"; > "process" string => "/usr/sbin/xntpd"; > "argument" string => " -x"; > "cfg_file" string => "/etc/ntp.conf"; > "cfg_source" string => "/etc/ntp.conf"; > "mode" string => "0664"; > "user" string => "root"; > "group" string => "system"; > > #SSH > "daemon" string => "sshd"; > "process" string => "/usr/sbin/sshd"; > "argument" string => ""; > "cfg_file" string => "/etc/ssh/sshd_config"; > "cfg_source" string => "/etc/ssh/sshd_config"; > "mode" string => "0644"; > "user" string => "root"; > "group" string => "system";
I dont understand how the variables arent clobbering eachother in this policy. Maybe its late and I am missing something, but it looks to me like your redefining daemon, processes, argument, cfg_file, cfg_source, mode, user, group. Did you intend for those to be arrays? Is this working for you? -- Nick Anderson <n...@cmdln.org> _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine