forked from cfengine/masterfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
promises.cf
247 lines (200 loc) · 8.27 KB
/
promises.cf
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
###############################################################################
#
# promises.cf - Basic Policy for CFEngine
#
###############################################################################
body common control
{
bundlesequence => {
# Common bundle first (Best Practice)
inventory_control,
@(inventory.bundles),
ha_def,
def,
cfe_internal_hub_vars,
# Design Center
cfsketch_run,
# autorun system
services_autorun,
@(services_autorun.bundles),
# Agent bundle
cfe_internal_management, # See cfe_internal/CFE_cfengine.cf
service_catalogue,
ha_main,
};
inputs => {
# File definition for global variables and classes
"cfe_internal/ha/ha_def.cf",
"def.cf",
# Inventory policy
@(inventory.inputs),
# Design Center
"sketches/meta/api-runfile.cf",
@(cfsketch_g.inputs),
# CFEngine internal processes for Mission Portal mostly
"cfe_internal/CFE_cfengine.cf",
"cfe_internal/CFE_hub_specific.cf",
"cfe_internal/CFE_knowledge.cf",
# Control body for all CFEngine robot agents
@(cfengine_controls.inputs),
# COPBL/Custom libraries. Eventually this should use wildcards.
@(cfengine_stdlib.inputs),
# Reports
@(cfengine_reports.inputs),
# autorun system
@(services_autorun.inputs),
# Add update files to build Knowledge Map relationship
"update/update_bins.cf",
"update/cfe_internal_dc_workflow.cf",
"update/cfe_internal_local_git_remote.cf",
"update/cfe_internal_update_from_repository.cf",
"update/update_policy.cf",
"update/update_processes.cf",
# List of services here
"services/file_change.cf",
"cfe_internal/ha/ha.cf"
};
version => "CFEngine Promises.cf 3.7.0";
# Uncomment to connect to the hub using latest protocol.
#protocol_version => "latest";
# goal_categories => { "goals", "targets", "milestones" };
# goal_patterns => { "goal_.*", "target.*","milestone.*" };
}
#
bundle common inventory
# @brief Set up inventory inputs
#
# This bundle creates the inputs for inventory bundles.
#
# Inventory bundles are simply common bundles loaded before anything
# else in promises.cf
#
# Tested to work properly against 3.5.x
{
classes:
"other_unix_os" expression => "!windows.!macos.!linux";
"specific_linux_os" expression => "redhat|debian|suse";
vars:
# This list is intended to grow as needed
!cfengine_3_5.debian::
"inputs" slist => { "inventory/any.cf", "inventory/linux.cf", "inventory/lsb.cf", "inventory/debian.cf", "inventory/os.cf" };
"bundles" slist => { "inventory_control", "inventory_any", "inventory_autorun", "inventory_linux", "inventory_lsb", "inventory_debian", "inventory_os" };
!cfengine_3_5.redhat::
"inputs" slist => { "inventory/any.cf", "inventory/linux.cf", "inventory/lsb.cf", "inventory/redhat.cf", "inventory/os.cf" };
"bundles" slist => { "inventory_control", "inventory_any", "inventory_autorun", "inventory_linux", "inventory_lsb", "inventory_redhat", "inventory_os" };
!cfengine_3_5.suse::
"inputs" slist => { "inventory/any.cf", "inventory/linux.cf", "inventory/lsb.cf", "inventory/suse.cf", "inventory/os.cf" };
"bundles" slist => { "inventory_control", "inventory_any", "inventory_autorun", "inventory_linux", "inventory_lsb", "inventory_suse", "inventory_os" };
!cfengine_3_5.windows::
"inputs" slist => { "inventory/any.cf", "inventory/windows.cf", "inventory/os.cf" };
"bundles" slist => { "inventory_control", "inventory_any", "inventory_autorun", "inventory_windows", "inventory_os" };
!cfengine_3_5.macos::
"inputs" slist => { "inventory/any.cf", "inventory/macos.cf", "inventory/os.cf" };
"bundles" slist => { "inventory_control", "inventory_any", "inventory_autorun", "inventory_macos", "inventory_os" };
!cfengine_3_5.linux.!specific_linux_os::
"inputs" slist => { "inventory/any.cf", "inventory/linux.cf", "inventory/lsb.cf", "inventory/os.cf"};
"bundles" slist => { "inventory_control", "inventory_any", "inventory_autorun", "inventory_linux", "inventory_lsb", "inventory_os" };
!cfengine_3_5.other_unix_os::
"inputs" slist => { "inventory/any.cf", "inventory/generic.cf", "inventory/os.cf" };
"bundles" slist => { "inventory_control", "inventory_any", "inventory_autorun", "inventory_generic", "inventory_os" };
cfengine_3_5::
"inputs" slist => { };
"bundles" slist => { };
reports:
verbose_mode::
"$(this.bundle): loading inventory module '$(inputs)'";
}
#
bundle common cfengine_stdlib
{
vars:
cfengine_3_5::
# 3.5 doesn't have "body file control" so all the includes are listed here
"inputs" slist => {
"lib/3.5/paths.cf",
"lib/3.5/common.cf",
"lib/3.5/commands.cf",
"lib/3.5/packages.cf",
"lib/3.5/files.cf",
"lib/3.5/services.cf",
"lib/3.5/processes.cf",
"lib/3.5/storage.cf",
"lib/3.5/databases.cf",
"lib/3.5/monitor.cf",
"lib/3.5/guest_environments.cf",
"lib/3.5/bundles.cf",
"lib/3.5/reports.cf",
"lib/3.5/cfe_internal.cf",
};
!cfengine_3_5::
# CFEngine 3.6 and higher can include through a secondary file
"inputs" slist => { "$(sys.local_libdir)/stdlib.cf" };
reports:
verbose_mode::
"$(this.bundle): defining inputs='$(inputs)'";
}
#
bundle common cfengine_controls
{
vars:
"inputs" slist => {
"controls/cf_agent.cf",
"controls/cf_execd.cf",
"controls/cf_hub.cf",
"controls/cf_monitord.cf",
"controls/cf_runagent.cf",
"controls/cf_serverd.cf",
};
reports:
verbose_mode::
"$(this.bundle): defining inputs='$(inputs)'";
}
bundle common cfengine_reports
{
vars:
cfengine_3_5::
"inputs" slist => { cf_null };
!cfengine_3_5::
"inputs" slist => {
"cfe_internal/host_info_report.cf",
};
reports:
verbose_mode::
"$(this.bundle): defining inputs='$(inputs)'";
}
bundle common services_autorun
{
vars:
cfengine_3_5||!services_autorun::
"inputs" slist => { };
"found_inputs" slist => {};
"bundles" slist => { "services_autorun" }; # run self
!cfengine_3_5::
"inputs" slist => { "services/autorun.cf" };
"found_inputs" slist => lsdir("$(this.promise_dirname)/services/autorun", ".*\.cf", "true");
"bundles" slist => { "autorun" }; # run loaded bundles
reports:
verbose_mode::
"$(this.bundle): defining inputs='$(inputs)'";
}
###############################################################################
#
# bundle agent service_catalogue
# - general purposes of usage
#
###############################################################################
bundle agent service_catalogue
{
methods:
any::
"security" -> { goal_infosec, goal_compliance }
comment => "Basic change management",
handle => "service_catalogue_change_management",
usebundle => change_management;
}
# special body for update/*.cf compatibility
body classes u_kept_successful_command
# @brief Set command to "kept" instead of "repaired" if it returns 0
{
kept_returncodes => { "0" };
}