summaryrefslogtreecommitdiff
path: root/services/common.cf
blob: de738a8ab48bcbd236cb2fdc1fe0c9750bef7369 (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
43
44
45
46
47
48
49
50
51
52
53
54
bundle agent common
{
    files:
        any::
            "/etc/hosts"
                create => "true",
                edit_defaults => empty,
                perms => system_owned("444"),
                edit_template => "$(sys.inputdir)/templates/common/hosts.cftpl",
                template_method => "cfengine",
                classes => if_repaired("common_hosts_files_repaired");
    reports:
        any::
            "$(this.bundle): /etc/hosts repaired" ifvarclass => "common_hosts_files_repaired";
}

bundle agent home_skel(caller, user)
{
    files:
        any::
            "/home/$(user)/."
                create => "true",
                copy_from => seed_cp("/etc/skel"),
                depth_search => recurse("inf"),
                classes => if_repaired("$(caller)_home_skel_$(user)_repaired");
    reports:
        any::
            "$(caller): /home/$(user) initialized" ifvarclass => "$(caller)_home_skel_$(user)_repaired";
}

bundle agent install_package(caller, package)
{
    vars:
        "normalised_name" string => canonify("$(package)");
    packages:
        centos::
            "$(package)"
                policy => "present",
                package_module => yum,
                classes => if_repaired("$(caller)_common_package_$(normalised_name)_add_repaired");
        debian|ubuntu::
            "$(package)"
                policy => "present",
                package_module => apt_get,
                classes => if_repaired("$(caller)_common_package_$(normalised_name)_add_repaired");
        freebsd::
            "$(package)"
                policy => "present",
                package_module => pkg,
                classes => if_repaired("$(caller)_common_package_$(normalised_name)_add_repaired");
    reports:
        any::
            "$(caller): $(package) installed" ifvarclass => "$(caller)_common_package_$(normalised_name)_add_repaired";
}