summaryrefslogtreecommitdiff
path: root/services/inventory.cf
blob: 933f689eb2ccf60983bae21420dd74e3466bff19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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::
            "$(inventory_dir)/."
                create => "true",
                perms => system_owned("700"),
                classes => if_repaired("inventory_folder_repaired");
            "$(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): $(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");
}