I want to put body package_method
and some variables in promises.cf or in a different file and I should be able to call it from any new CF files I write.
Is that possible? I could not find anything related to such methods in the documentation.
I was thinking of creating a new file in /var/cfengine/masterfiles/
and then edit /var/cfengine/promises.cf
and insert the new file as inputs
but it did not work out.
Here is what I want to put (in a new file maybe) which should be accessible globally.
bundle common variables
{
vars:
"global_var_1" string => "value_var_1";
}
and
body package_method yum
{
any::
package_changes => "bulk";
package_list_command => "/usr/bin/yum list installed";
package_list_name_regex => "([^.]+).*";
package_list_version_regex => "[^\s]\s+([^\s]+).*";
package_list_arch_regex => "[^.]+\.([^\s]+).*";
package_installed_regex => ".*installed.*";
package_name_convention => "$(name).$(arch)";
package_name_regex => "amanda-client";
package_arch_regex => "x86_64";
package_add_command => "/usr/bin/yum -y install";
package_delete_command => "/bin/rpm -e";
package_verify_command => "/bin/rpm -V";
}
Then I should be able call it in any new CF as:
"${variables.global_var_1}"
and
bundle agent packages
{
packages:
"wget"
package_policy => "add",
package_method => yum;
}