blob: ea7461235ad3d94920363ff9078c0dede20eec77 (
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
|
bundle agent nginx(source, destination)
{
methods:
freebsd::
"freebsd" usebundle => install_package("$(this.bundle)", "nginx");
vars:
freebsd::
"repaired_conf_classes" slist => { "nginx_nginx_conf_$(destination)_file_repaired", "nginx_needs_restarting" };
files:
freebsd::
"/usr/local/etc/nginx/$(destination)"
create => "true",
edit_defaults => empty,
perms => system_owned("444"),
edit_template => "$(source)",
classes => if_repaired(@(repaired_conf_classes));
classes:
freebsd::
"nginx_service_running" expression => returnszero("/usr/sbin/service nginx status", "noshell");
methods:
freebsd::
"freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "nginx_enable=\"YES\"");
commands:
freebsd.!nginx_service_running::
"/usr/sbin/service nginx start" classes => if_repaired("nginx_service_repaired");
freebsd.nginx_needs_restarting::
"/usr/sbin/service nginx restart" classes => if_repaired("nginx_service_restarted");
reports:
any::
"$(this.bundle): /usr/local/etc/nginx/$(destination) repaired" ifvarclass => "nginx_nginx_conf_$(destination)_file_repaired";
"$(this.bundle): nginx service repaired" ifvarclass => "nginx_service_repaired";
"$(this.bundle): nginx service restarted" ifvarclass => "nginx_service_restarted";
}
|