Forum: CFEngine Help Subject: Re: Using Variables in insert lines Author: zzamboni Link to topic: https://cfengine.com/forum/read.php?3,24417,24418#msg-24418
You almost got it: bundle agent conf_system_syslog { vars: ipv4_192_168_235:: "syslog_host" string => "192.167.235.34"; ipv4_192_168_5:: "syslog_host" string => "192.167.5.12" ; files: "/etc/syslog.conf" edit_line => sysklog_config; } bundle edit_line sysklog_config { insert_lines: redhat_5&!cpp_syslog_host:: "*.info;mail.none;authpriv.none;cron.none @$(syslog_host)"; } I made syslog_host a string rather than a list, and then it can be directly used in the string you insert in the configuration file. Note that if syslog_host changes, then the promise will insert a new line into the file, rather than editing the existing one. For this you could use something like set_config_values: https://gist.github.com/548981 , with something like this: bundle agent conf_system_syslog { vars: ipv4_192_168_235:: "syslog_conf[*.info;mail.none;authpriv.none;cron.none]" string => "192.167.235.34"; ipv4_192_168_5:: "syslog_conf[*.info;mail.none;authpriv.none;cron.none]" string => "192.167.5.12" ; files: "/etc/syslog.conf" edit_line => set_config_values("conf_system_syslog.syslog_conf"); } _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine