Difference between revisions of "Bundle agent update"
| Line 1: | Line 1: | ||
| + | Dynamic CCFEngine3 requires the update bundle to pull information specific to the domain, host and role into the input_webhuis branch on the node. The node should only have the required bundles and therefore purging of obsolete files is set. |
||
<pre> |
<pre> |
||
############################################################################### |
############################################################################### |
||
| Line 10: | Line 11: | ||
############################################################################### |
############################################################################### |
||
| + | bundle agent update { |
||
| + | |||
| + | files: |
||
| + | "$(sys.workdir)/inputs" |
||
| + | comment => "Copy policy updates from master source on policy server if a new validation was acquired", |
||
| + | handle => "update_files_inputs_dir", |
||
| + | copy_from => u_secure_cp("${g.master_location}","${sys.policy_hub}"), |
||
| + | depth_search => u_recurse("inf"), |
||
| + | file_select => u_inputfiles, |
||
| + | action => u_immediate; |
||
| + | |||
| + | "$(sys.workdir)/inputs-webhuis/domain/${sys.domain}.cf" |
||
| + | comment => "Copy domain policy updates from master source on policy server if a new validation was acquired", |
||
| + | handle => "update_files_inputs_domain_dir", |
||
| + | copy_from => u_secure_cp("${g.master_domain}/${sys.domain}/${sys.domain}.cf","${sys.policy_hub}"), |
||
| + | file_select => u_inputdomain, |
||
| + | action => u_immediate; |
||
| + | |||
| + | "$(sys.workdir)/inputs-webhuis/host/${sys.uqhost}.cf" |
||
| + | comment => "Copy host policy updates from master source on policy server if a new validation was acquired", |
||
| + | handle => "update_files_inputs_host_dir", |
||
| + | copy_from => u_secure_cp("${g.master_domain}/${sys.domain}/${sys.uqhost}.cf","${sys.policy_hub}"), |
||
| + | file_select => u_inputhost, |
||
| + | action => u_immediate; |
||
| + | |||
| + | "$(sys.workdir)/inputs-webhuis/role/${role.role}.cf" |
||
| + | comment => "Copy roles updates from master source on policy server if a new validation was acquired", |
||
| + | handle => "update_files_inputs_role_dir", |
||
| + | copy_from => u_secure_cp("${g.master_roles}/${role.role}.cf","${sys.policy_hub}"), |
||
| + | file_select => u_inputfiles, |
||
| + | action => u_immediate; |
||
| + | |||
| + | "$(sys.workdir)/inputs-webhuis/components/${${g.role}.input}" |
||
| + | comment => "Copy components updates from master source on policy server if a new validation was acquired", |
||
| + | handle => "update_files_inputs_components_dir", |
||
| + | copy_from => u_secure_cp("/var/cfengine/webhuis/components/${${g.role}.input}","${sys.policy_hub}"), |
||
| + | file_select => u_inputfiles, |
||
| + | action => u_immediate; |
||
| + | } |
||
| + | |||
| + | ######################################################### |
||
| + | body copy_from u_secure_cp(from,server) |
||
| + | { |
||
| + | source => "$(from)"; |
||
| + | servers => { "$(sys.policy_hub)" }; |
||
| + | trustkey => "false"; |
||
| + | encrypt => "true"; |
||
| + | purge => "true"; |
||
| + | |||
| + | } |
||
| + | ######################################################### |
||
| + | |||
| + | body action u_immediate |
||
| + | { |
||
| + | ifelapsed => "0"; |
||
| + | } |
||
| + | |||
| + | ######################################################### |
||
| + | |||
| + | body depth_search u_recurse(d) |
||
| + | { |
||
| + | depth => "$(d)"; |
||
| + | exclude_dirs => { "\.svn", "\.git" }; |
||
| + | } |
||
| + | |||
| + | body file_select u_inputfiles |
||
| + | { |
||
| + | leaf_name => { ".*.cf",".*.dat",".*.txt" }; |
||
| + | file_result => "leaf_name"; |
||
| + | } |
||
| + | |||
| + | body file_select u_inputdomain |
||
| + | { |
||
| + | leaf_name => { ".*.cf",".*.dat",".*.txt" }; |
||
| + | file_result => "leaf_name"; |
||
| + | } |
||
| + | |||
| + | body file_select u_inputhost |
||
| + | { |
||
| + | leaf_name => { ".*.cf",".*.dat",".*.txt" }; |
||
| + | file_result => "leaf_name"; |
||
| + | } |
||
</pre> |
</pre> |
||
<hr> |
<hr> |
||
Latest revision as of 14:20, 18 May 2014
Dynamic CCFEngine3 requires the update bundle to pull information specific to the domain, host and role into the input_webhuis branch on the node. The node should only have the required bundles and therefore purging of obsolete files is set.
###############################################################################
#
# Webhuis agent update, applicable to all hosts
#
# Copyright (C) 2008 Martin Simons, Webhuis. Renkum The Netherlands
# This source code is licensed under the GNU General Public License, Version 2.
# See http://webhuis.nl/GPL-license for more details.
#
###############################################################################
bundle agent update {
files:
"$(sys.workdir)/inputs"
comment => "Copy policy updates from master source on policy server if a new validation was acquired",
handle => "update_files_inputs_dir",
copy_from => u_secure_cp("${g.master_location}","${sys.policy_hub}"),
depth_search => u_recurse("inf"),
file_select => u_inputfiles,
action => u_immediate;
"$(sys.workdir)/inputs-webhuis/domain/${sys.domain}.cf"
comment => "Copy domain policy updates from master source on policy server if a new validation was acquired",
handle => "update_files_inputs_domain_dir",
copy_from => u_secure_cp("${g.master_domain}/${sys.domain}/${sys.domain}.cf","${sys.policy_hub}"),
file_select => u_inputdomain,
action => u_immediate;
"$(sys.workdir)/inputs-webhuis/host/${sys.uqhost}.cf"
comment => "Copy host policy updates from master source on policy server if a new validation was acquired",
handle => "update_files_inputs_host_dir",
copy_from => u_secure_cp("${g.master_domain}/${sys.domain}/${sys.uqhost}.cf","${sys.policy_hub}"),
file_select => u_inputhost,
action => u_immediate;
"$(sys.workdir)/inputs-webhuis/role/${role.role}.cf"
comment => "Copy roles updates from master source on policy server if a new validation was acquired",
handle => "update_files_inputs_role_dir",
copy_from => u_secure_cp("${g.master_roles}/${role.role}.cf","${sys.policy_hub}"),
file_select => u_inputfiles,
action => u_immediate;
"$(sys.workdir)/inputs-webhuis/components/${${g.role}.input}"
comment => "Copy components updates from master source on policy server if a new validation was acquired",
handle => "update_files_inputs_components_dir",
copy_from => u_secure_cp("/var/cfengine/webhuis/components/${${g.role}.input}","${sys.policy_hub}"),
file_select => u_inputfiles,
action => u_immediate;
}
#########################################################
body copy_from u_secure_cp(from,server)
{
source => "$(from)";
servers => { "$(sys.policy_hub)" };
trustkey => "false";
encrypt => "true";
purge => "true";
}
#########################################################
body action u_immediate
{
ifelapsed => "0";
}
#########################################################
body depth_search u_recurse(d)
{
depth => "$(d)";
exclude_dirs => { "\.svn", "\.git" };
}
body file_select u_inputfiles
{
leaf_name => { ".*.cf",".*.dat",".*.txt" };
file_result => "leaf_name";
}
body file_select u_inputdomain
{
leaf_name => { ".*.cf",".*.dat",".*.txt" };
file_result => "leaf_name";
}
body file_select u_inputhost
{
leaf_name => { ".*.cf",".*.dat",".*.txt" };
file_result => "leaf_name";
}
Return to: Dynamic_Cfengine3