diff options
-rw-r--r-- | services/inventory.cf | 31 |
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"); } |