summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2018-05-04 15:19:35 +0200
committerJulien Dessaux2018-05-04 15:19:35 +0200
commit1bf5f37d28094fc5a929c4072fe0600c1f24eb20 (patch)
tree44e76c214899d215d631fd785c3feccc32e43b69
parentBootstrapped inventory system (diff)
downloadmasterfiles-1bf5f37d28094fc5a929c4072fe0600c1f24eb20.tar.gz
masterfiles-1bf5f37d28094fc5a929c4072fe0600c1f24eb20.tar.bz2
masterfiles-1bf5f37d28094fc5a929c4072fe0600c1f24eb20.zip
Added inventory collection back to policy hub
-rw-r--r--services/inventory.cf31
1 files changed, 28 insertions, 3 deletions
diff --git a/services/inventory.cf b/services/inventory.cf
index 93bd580..933f689 100644
--- a/services/inventory.cf
+++ b/services/inventory.cf
@@ -1,17 +1,42 @@
bundle agent inventory
{
+ vars:
+ any::
+ "inventory_dir" string => "$(sys.workdir)/inventory";
+ am_policy_hub::
+ "data_dir" string => "$(sys.workdir)/inventory_data";
+ "lastseen" slist => { hostsseen( "2", "lastseen", "address" ) };
+ "clients" slist => { "$(sys.policy_hub)", "@(lastseen)" };
files:
any::
- "$(sys.workdir)/inventory/."
+ "$(inventory_dir)/."
create => "true",
perms => system_owned("700"),
classes => if_repaired("inventory_folder_repaired");
- "$(sys.workdir)/inventory/host_info_report"
+ "$(inventory_dir)/host_info_report"
create => "true",
perms => system_owned("400"),
edit_template => "$(sys.inputdir)/templates/inventory/host_info_report.mustache",
template_method => "mustache";
+ am_policy_hub::
+ "$(data_dir)/."
+ create => "true",
+ perms => system_owned("700"),
+ classes => if_repaired("inventory_data_folder_repaired");
+ methods:
+ am_policy_hub::
+ "any" usebundle => bg_inventory_get("$(data_dir)", "$(clients)"), action => bg("5", "5");
reports:
any::
- "$(this.bundle): $(sys.workdir)/inventory folder repaired" ifvarclass => "inventory_folder_repaired";
+ "$(this.bundle): $(inventory_dir) folder repaired" ifvarclass => "inventory_folder_repaired";
+ "$(this.bundle): $(data_dir) folder repaired" ifvarclass => "inventory_data_folder_repaired";
+}
+
+bundle agent bg_inventory_get(download_dir, clients)
+{
+ files:
+ "$(download_dir)/$(clients)"
+ copy_from => remote_dcp("inventory", "$(clients)"),
+ depth_search => recurse("inf"),
+ perms => m("400");
}