File: cfengine_processes.cf

package info (click to toggle)
cfengine3 3.6.2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,256 kB
  • ctags: 9,613
  • sloc: ansic: 116,129; sh: 12,366; yacc: 1,088; makefile: 1,006; lex: 391; perl: 197; xml: 21; sed: 4
file content (219 lines) | stat: -rw-r--r-- 6,214 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
##################################################################
#
# cfe_internal_processes
# - restart CFE processes by specific time (not in service)
#
##################################################################

bundle agent cfe_internal_processes
{
  vars:

      "cf_components"   slist => {
				   "cf-key",
				   "cf-monitord",
				   "cf-promises",
				   "cf-runagent",
				   "cf-serverd",
				   "cf-hub"
      },
      comment => "Define all cfengine robot agents",
      handle => "cfe_internal_processes_vars_cf_components";

    windows::

      "stop_signal"  string => "kill",
      comment => "Define a stop signal for Windows",
      handle => "cfe_internal_processes_vars_stop_signal_windows";

    !windows::

      "stop_signal"  string => "term",
      comment => "Define a stop signal for *NIX",
      handle => "cfe_internal_processes_vars_stop_signal_unix";

      #

  classes:
      #  NOTE: We do not restart by default, can be added if desired
      #  "restart_cf" expression => "Monday.Hr05.Min00_05"
      #                  comment => "Define a class to restart cfengine processes",
      #                   handle => "cfe_internal_processes_classes_restart_cf";

      #

  processes:

    restart_cf::

      "$(cf_components)"

      signals => { "$(stop_signal)" },
      comment => "Kill cfengine processes",
      handle => "cfe_internal_processes_stop_cf_components";

    restart_cf.!windows::

      "cf-execd"
      signals => { "$(stop_signal)" },
      comment => "Kill cf-execd process on *NIX",
      handle => "cfe_internal_processes_stop_cf_execd";

      #

  commands:

    restart_cf.!windows::

      "$(sys.cf_execd)"
      comment => "Restart cf-execd process",
      classes => kept_successful_command,
      handle => "cfe_internal_processes_commands_cf_execd";

      #

  services:

    restart_cf.windows::

      "CfengineNovaExec"
      service_policy => "stop",
      comment => "Stop the executor service, part of scheduled restart",
      handle => "cfe_internal_processes_services_stop_cf_execd_windows";

      "CfengineNovaExec"
      service_policy => "start",
      comment => "Start the executor service, part of scheduled restart",
      handle => "cfe_internal_processes_services_start_cf_execd_windows";

      #

  reports:

    restart_cf::

      "Reloaded configuration of all Cfengine components",
      comment => "Alert restarting message",
      handle => "cfe_internal_processes_reports";

}

##################################################################
#
# cfe_internal_enable
# - start CFE agents when booting (not in service)
#
##################################################################

bundle agent cfe_internal_enable
{
  vars:

    freebsd::

      "rc_conf[cfengine_enable]"   string => "\"YES\"",
      comment => "Define a variable to start cfengine at boot time",
      handle => "cfe_internal_enable_vars_rc_conf_freebsd";

    netbsd::

      "rc_conf[cfengine_enable]"  string => "\"YES\"",
      comment => "Define a variable to start cfengine at boot time",
      handle => "cfe_internal_enable_vars_rc_conf_netbsd";

    linux::

      "rc_files"   slist => {
                              "/etc/rc1.d/K11cfengine3",
                              "/etc/rc2.d/S90cfengine3",
                              "/etc/rc3.d/S90cfengine3",
                              "/etc/rc4.d/S90cfengine3",
                              "/etc/rc5.d/S90cfengine3",
                              "/etc/rc6.d/K11cfengine3"
      },
      comment => "Define a list of rc files on Linux",
      handle => "cfe_internal_enable_vars_rc_files";

      #

  files:

    freebsd::

      "/usr/local/etc/rc.d/cfengine3.sh"
      comment => "Ensure that the cfengine rc.d script is executable",
      handle => "cfe_internal_enable_files_cfengine3_sh_freebsd",
      perms => mog("755", "root", "wheel");

      "/etc/rc.conf"
      comment => "cfengine libraries should be enabled in rc.conf if appropriate",
      handle => "cfe_internal_enable_files_rc_conf_freebsd_1",
      edit_line => append_if_no_line("[ -e /var/cfengine/lib ] && /sbin/ldconfig -m /var/cfengine/lib");

      "/etc/rc.conf"
      comment => "cfengine should be enabled in rc.conf",
      handle => "cfe_internal_enable_files_rc_conf_freebsd_2",
      edit_line => set_variable_values("cfengine_enable.rc_conf");

    netbsd::

      "/usr/local/etc/rc.d/cfengine3.sh"
      comment => "Ensure that the cfengine rc.d script is executable",
      handle => "cfe_internal_enable_files_cfengine3_sh_netbsd",
      perms => mog("755", "root", "wheel");

      "/etc/rc.d/cfengine"
      comment => "Move cfengine rc.d script to the correct location",
      handle => "cfe_internal_enable_files_rc_d_netbsd",
      copy_from => local_cp("/usr/local/etc/rc.d/cfengine3.sh");

      "/etc/rc.conf"
      comment => "cfengine should be enabled in rc.conf",
      handle => "cfe_internal_enable_files_rc_conf_netbsd",
      edit_line => set_variable_values("cfengine_enable.rc_conf");

    linux::

      "$(rc_files)"
      comment => "Ensure that startup scripts are properly linked",
      handle => "cfe_internal_enable_files_rc_files_linux",
      link_from => ln_s("/etc/init.d/cfengine3");
}

##################################################################
#
# cfe_internal_build_software_report
# - force machines to have package promises to be able to generate
#   software reports (not in service)
#
##################################################################

bundle agent cfe_internal_build_software_report
{
  packages:

    redhat::

      "wget"
      comment => "Install packages from the list",
      handle => "cfe_internal_build_software_report_redhat",
      package_policy => "add",
      package_method => yum;

    debian::

      "wget"
      comment => "Install packages from the list",
      handle => "cfe_internal_build_software_report_debian",
      package_policy => "add",
      package_method => apt;

    (SuSE|suse)::

      "wget"
      comment => "Install packages from the list",
      handle => "cfe_internal_build_software_report_suse",
      package_policy => "add",
      package_method => zypper;

}