chef 16.5.77 → 16.6.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/chef/application/client.rb +6 -1
- data/lib/chef/client.rb +2 -31
- data/lib/chef/data_collector.rb +1 -1
- data/lib/chef/mixin/powershell_exec.rb +22 -10
- data/lib/chef/mixin/powershell_out.rb +12 -5
- data/lib/chef/node/mixin/immutablize_hash.rb +2 -0
- data/lib/chef/powershell.rb +3 -2
- data/lib/chef/provider/ifconfig.rb +1 -1
- data/lib/chef/provider/ifconfig/debian.rb +33 -15
- data/lib/chef/provider/ifconfig/redhat.rb +51 -17
- data/lib/chef/provider/powershell_script.rb +12 -1
- data/lib/chef/pwsh.rb +64 -0
- data/lib/chef/resource/apt_repository.rb +2 -3
- data/lib/chef/resource/chef_client_config.rb +313 -0
- data/lib/chef/resource/chef_client_cron.rb +5 -5
- data/lib/chef/resource/chef_client_scheduled_task.rb +4 -4
- data/lib/chef/resource/chef_client_systemd_timer.rb +5 -5
- data/lib/chef/resource/chef_sleep.rb +1 -1
- data/lib/chef/resource/cron/cron_d.rb +2 -2
- data/lib/chef/resource/kernel_module.rb +1 -1
- data/lib/chef/resource/launchd.rb +15 -15
- data/lib/chef/resource/mount.rb +1 -1
- data/lib/chef/resource/powershell_script.rb +7 -1
- data/lib/chef/resource/support/client.erb +65 -0
- data/lib/chef/resource/windows_audit_policy.rb +26 -24
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/mixin/powershell_out_spec.rb +9 -1
- data/spec/functional/resource/powershell_script_spec.rb +57 -14
- data/spec/spec_helper.rb +1 -0
- data/spec/support/platform_helpers.rb +6 -1
- data/spec/unit/mixin/powershell_exec_spec.rb +40 -3
- data/spec/unit/mixin/powershell_out_spec.rb +14 -0
- data/spec/unit/provider/powershell_script_spec.rb +11 -0
- data/spec/unit/resource/chef_client_config_spec.rb +137 -0
- data/spec/unit/resource/powershell_script_spec.rb +2 -2
- metadata +11 -7
@@ -62,15 +62,14 @@ class Chef
|
|
62
62
|
end
|
63
63
|
```
|
64
64
|
|
65
|
-
**Add the JuJu PPA, grab the key from the keyserver, and add source repo**:
|
65
|
+
**Add the JuJu PPA, grab the key from the Ubuntu keyserver, and add source repo**:
|
66
66
|
|
67
67
|
```ruby
|
68
68
|
apt_repository 'juju' do
|
69
|
-
uri '
|
69
|
+
uri 'ppa:juju/stable'
|
70
70
|
components ['main']
|
71
71
|
distribution 'xenial'
|
72
72
|
key 'C8068B11'
|
73
|
-
keyserver 'keyserver.ubuntu.com'
|
74
73
|
action :add
|
75
74
|
deb_src true
|
76
75
|
end
|
@@ -0,0 +1,313 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require_relative "../resource"
|
18
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
19
|
+
|
20
|
+
class Chef
|
21
|
+
class Resource
|
22
|
+
class ChefClientConfig < Chef::Resource
|
23
|
+
unified_mode true
|
24
|
+
|
25
|
+
provides :chef_client_config
|
26
|
+
|
27
|
+
description "Use the **chef_client_config** resource to create a client.rb file in the #{ChefUtils::Dist::Infra::PRODUCT} configuration directory. See the [client.rb docs](https://docs.chef.io/config_rb_client/) for more details on options available in the client.rb configuration file."
|
28
|
+
introduced "16.6"
|
29
|
+
examples <<~DOC
|
30
|
+
**Bare minimum #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
|
31
|
+
|
32
|
+
The absolute minimum configuration necessary for a node to communicate with the Infra Server is the URL of the Infra Server. All other configuration options either have values at the server side (Policyfiles, Roles, Environments, etc) or have default values determined at client startup.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
chef_client_config 'Create client.rb' do
|
36
|
+
chef_server_url 'https://chef.example.dmz'
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
**More complex #{ChefUtils::Dist::Infra::PRODUCT} client.rb**:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
chef_client_config 'Create client.rb' do
|
44
|
+
chef_server_url 'https://chef.example.dmz'
|
45
|
+
log_level :info
|
46
|
+
log_location :syslog
|
47
|
+
http_proxy 'proxy.example.dmz'
|
48
|
+
https_proxy 'proxy.example.dmz'
|
49
|
+
no_proxy %w(internal.example.dmz)
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
**Adding additional config content to the client.rb**:
|
54
|
+
|
55
|
+
This resource aims to provide common configuration options. Some configuration options are missing and some users may want to use arbitrary Ruby code within their configuration. For this we offer an `additional_config` property that can be used to add any configuration or code to the bottom of the `client.rb` file. Also keep in mind that within the configuration directory is a `client.d` directory where you can put additional `.rb` files containing configuration options. These can be created using `file` or `template` resources within your cookbooks as necessary.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
chef_client_config 'Create client.rb' do
|
59
|
+
chef_server_url 'https://chef.example.dmz'
|
60
|
+
additional_config <<~CONFIG
|
61
|
+
# Extra config code to safely load a gem into the client run.
|
62
|
+
# Since the config is Ruby you can run any Ruby code you want via the client.rb.
|
63
|
+
# It's a great way to break things, so be careful
|
64
|
+
begin
|
65
|
+
require 'aws-sdk'
|
66
|
+
rescue LoadError
|
67
|
+
Chef::Log.warn "Failed to load aws-sdk."
|
68
|
+
end
|
69
|
+
CONFIG
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
**Setup two report handlers in the client.rb**:
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
chef_client_config 'Create client.rb' do
|
77
|
+
chef_server_url 'https://chef.example.dmz'
|
78
|
+
report_handlers [
|
79
|
+
{
|
80
|
+
'class' => 'ReportHandler1Class',
|
81
|
+
'arguments' => ["'FirstArgument'", "'SecondArgument'"],
|
82
|
+
},
|
83
|
+
{
|
84
|
+
'class' => 'ReportHandler2Class',
|
85
|
+
'arguments' => ["'FirstArgument'", "'SecondArgument'"],
|
86
|
+
},
|
87
|
+
]
|
88
|
+
end
|
89
|
+
```
|
90
|
+
DOC
|
91
|
+
|
92
|
+
# @todo policy_file or policy_group being set requires the other to be set so enforce that.
|
93
|
+
# @todo all properties for automate report
|
94
|
+
# @todo add all descriptions
|
95
|
+
# @todo validate handler hash structure
|
96
|
+
|
97
|
+
#
|
98
|
+
# @param [String, Symbol] prop_val the value from the property
|
99
|
+
#
|
100
|
+
# @return [Symbol] The symbol form of the symbol-like string, string, or symbol value
|
101
|
+
#
|
102
|
+
def string_to_symbol(prop_val)
|
103
|
+
if prop_val.is_a?(String) && prop_val.start_with?(":")
|
104
|
+
prop_val[1..-1].to_sym
|
105
|
+
else
|
106
|
+
prop_val.to_sym
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
property :config_directory, String,
|
111
|
+
description: "The directory to store the client.rb in.",
|
112
|
+
default: ChefConfig::Config.etc_chef_dir,
|
113
|
+
default_description: "`/etc/chef/` on *nix-like systems and `C:\chef\` on Windows"
|
114
|
+
|
115
|
+
property :user, String,
|
116
|
+
description: "The user that should own the client.rb file and the configuration directory if it needs to be created. Note: The configuration directory will not be created if it already exists, which allows you to further control the setup of that directory outside of this resource."
|
117
|
+
|
118
|
+
property :group, String,
|
119
|
+
description: "The group that should own the client.rb file and the configuration directory if it needs to be created. Note: The configuration directory will not be created if it already exists, which allows you to further control the setup of that directory outside of this resource."
|
120
|
+
|
121
|
+
property :node_name, [String, NilClass], # this accepts nil so people can disable the default
|
122
|
+
description: "The name of the node. This configuration sets the `node.name` value used in cookbooks and the `client_name` value used when authenticating to a #{ChefUtils::Dist::Server::PRODUCT} to determine what configuration to apply. Note: By default this configuration uses the `node.name` value which would be set during bootstrap. Hard coding this value in the `client.rb` config avoids logic within #{ChefUtils::Dist::Server::PRODUCT} that performs DNS lookups and may fail in the event of a DNS outage. To skip this default value and instead use the built-in #{ChefUtils::Dist::Server::PRODUCT} logic, set this property to `nil`",
|
123
|
+
default: lazy { node.name },
|
124
|
+
default_description: "The `node.name` value reported by #{ChefUtils::Dist::Infra::PRODUCT}."
|
125
|
+
|
126
|
+
property :chef_server_url, String,
|
127
|
+
description: "The URL for the #{ChefUtils::Dist::Server::PRODUCT}.",
|
128
|
+
required: true
|
129
|
+
|
130
|
+
# @todo Allow passing this as a string and convert it to the symbol
|
131
|
+
property :ssl_verify_mode, [Symbol, String],
|
132
|
+
equal_to: %i{verify_none verify_peer},
|
133
|
+
coerce: proc { |x| string_to_symbol(x) },
|
134
|
+
description: <<~DESC
|
135
|
+
Set the verify mode for HTTPS requests.
|
136
|
+
|
137
|
+
* Use :verify_none for no validation of SSL certificates.
|
138
|
+
* Use :verify_peer for validation of all SSL certificates, including the #{ChefUtils::Dist::Server::PRODUCT} connections, S3 connections, and any HTTPS remote_file resource URLs used in #{ChefUtils::Dist::Infra::PRODUCT} runs. This is the recommended setting.
|
139
|
+
DESC
|
140
|
+
|
141
|
+
property :formatters, Array,
|
142
|
+
description: "",
|
143
|
+
default: []
|
144
|
+
|
145
|
+
property :event_loggers, Array,
|
146
|
+
description: "",
|
147
|
+
default: []
|
148
|
+
|
149
|
+
property :log_level, Symbol,
|
150
|
+
description: "The level of logging performed by the #{ChefUtils::Dist::Infra::PRODUCT}.",
|
151
|
+
equal_to: %i{auto trace debug info warn fatal}
|
152
|
+
|
153
|
+
property :log_location, [String, Symbol],
|
154
|
+
description: "The location to save logs to. This can either by a path to a log file on disk `:syslog` to log to Syslog, `:win_evt` to log to the Windows Event Log, or `'STDERR'`/`'STDOUT'` to log to the *nix text streams.",
|
155
|
+
callbacks: {
|
156
|
+
"accepts Symbol values of ':win_evt' for Windows Event Log or ':syslog' for Syslog" => lambda { |p|
|
157
|
+
p.is_a?(Symbol) ? %i{win_evt syslog}.include?(p) : true
|
158
|
+
},
|
159
|
+
}
|
160
|
+
|
161
|
+
property :http_proxy, String,
|
162
|
+
description: "The proxy server to use for HTTP connections."
|
163
|
+
|
164
|
+
property :https_proxy, String,
|
165
|
+
description: "The proxy server to use for HTTPS connections."
|
166
|
+
|
167
|
+
property :ftp_proxy, String,
|
168
|
+
description: "The proxy server to use for FTP connections."
|
169
|
+
|
170
|
+
property :no_proxy, [String, Array],
|
171
|
+
description: "A comma-separated list or an array of URLs that do not need a proxy.",
|
172
|
+
coerce: proc { |x| x.is_a?(Array) ? x.join(",") : x },
|
173
|
+
default: []
|
174
|
+
|
175
|
+
# @todo we need to fixup bad plugin naming inputs here
|
176
|
+
property :ohai_disabled_plugins, Array,
|
177
|
+
description: "Ohai plugins that should be disabled in order to speed up the #{ChefUtils::Dist::Infra::PRODUCT} run and reduce the size of node data sent to #{ChefUtils::Dist::Infra::PRODUCT}",
|
178
|
+
coerce: proc { |x| x.map { |v| string_to_symbol(v).capitalize } },
|
179
|
+
default: []
|
180
|
+
|
181
|
+
# @todo we need to fixup bad plugin naming inputs here
|
182
|
+
property :ohai_optional_plugins, Array,
|
183
|
+
description: "Optional Ohai plugins that should be enabled to provide additional Ohai data for use in cookbooks.",
|
184
|
+
coerce: proc { |x| x.map { |v| string_to_symbol(v).capitalize } },
|
185
|
+
default: []
|
186
|
+
|
187
|
+
property :minimal_ohai, [true, false],
|
188
|
+
description: "Run a minimal set of Ohai plugins providing data necessary for the execution of #{ChefUtils::Dist::Infra::PRODUCT}'s built-in resources. Setting this to true will skip many large and time consuming data sets such as `cloud` or `packages`. Setting this this to true may break cookbooks that assume all Ohai data will be present."
|
189
|
+
|
190
|
+
property :start_handlers, Array,
|
191
|
+
description: %q(An array of hashes that contain a report handler class and the arguments to pass to that class on initialization. The hash should include `class` and `argument` keys where `class` is a String and `argument` is an array of quoted String values. For example: `[{'class' => 'MyHandler', %w('"argument1"', '"argument2"')}]`),
|
192
|
+
default: []
|
193
|
+
|
194
|
+
property :report_handlers, Array,
|
195
|
+
description: %q(An array of hashes that contain a report handler class and the arguments to pass to that class on initialization. The hash should include `class` and `argument` keys where `class` is a String and `argument` is an array of quoted String values. For example: `[{'class' => 'MyHandler', %w('"argument1"', '"argument2"')}]`),
|
196
|
+
default: []
|
197
|
+
|
198
|
+
property :exception_handlers, Array,
|
199
|
+
description: %q(An array of hashes that contain a exception handler class and the arguments to pass to that class on initialization. The hash should include `class` and `argument` keys where `class` is a String and `argument` is an array of quoted String values. For example: `[{'class' => 'MyHandler', %w('"argument1"', '"argument2"')}]`),
|
200
|
+
default: []
|
201
|
+
|
202
|
+
property :chef_license, String,
|
203
|
+
description: "Accept the [Chef EULA](https://www.chef.io/end-user-license-agreement/)",
|
204
|
+
equal_to: %w{accept accept-no-persist accept-silent}
|
205
|
+
|
206
|
+
property :policy_name, String,
|
207
|
+
description: "The name of a policy, as identified by the `name` setting in a Policyfile.rb file. `policy_group` when setting this property."
|
208
|
+
|
209
|
+
property :policy_group, String,
|
210
|
+
description: "The name of a `policy group` that exists on the #{ChefUtils::Dist::Server::PRODUCT}. `policy_name` must also be specified when setting this property."
|
211
|
+
|
212
|
+
property :named_run_list, String,
|
213
|
+
description: "A specific named runlist defined in the node's applied Policyfile, which the should be used when running #{ChefUtils::Dist::Infra::PRODUCT}."
|
214
|
+
|
215
|
+
property :pid_file, String,
|
216
|
+
description: "The location in which a process identification number (pid) is saved. An executable, when started as a daemon, writes the pid to the specified file. "
|
217
|
+
|
218
|
+
property :file_cache_path, String,
|
219
|
+
description: "The location in which cookbooks (and other transient data) files are stored when they are synchronized. This value can also be used in recipes to download files with the `remote_file` resource."
|
220
|
+
|
221
|
+
property :file_backup_path, String,
|
222
|
+
description: "The location in which backup files are stored. If this value is empty, backup files are stored in the directory of the target file"
|
223
|
+
|
224
|
+
property :file_staging_uses_destdir, String,
|
225
|
+
description: "How file staging (via temporary files) is done. When `true`, temporary files are created in the directory in which files will reside. When `false`, temporary files are created under `ENV['TMP']`"
|
226
|
+
|
227
|
+
property :additional_config, String,
|
228
|
+
description: "Additional text to add at the bottom of the client.rb config. This can be used to run custom Ruby or to add less common config options"
|
229
|
+
|
230
|
+
action :create do
|
231
|
+
unless ::Dir.exist?(new_resource.config_directory)
|
232
|
+
directory new_resource.config_directory do
|
233
|
+
user new_resource.user unless new_resource.user.nil?
|
234
|
+
group new_resource.group unless new_resource.group.nil?
|
235
|
+
mode "0750"
|
236
|
+
recursive true
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
unless ::Dir.exist?(::File.join(new_resource.config_directory, "client.d"))
|
241
|
+
directory ::File.join(new_resource.config_directory, "client.d") do
|
242
|
+
user new_resource.user unless new_resource.user.nil?
|
243
|
+
group new_resource.group unless new_resource.group.nil?
|
244
|
+
mode "0750"
|
245
|
+
recursive true
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
template ::File.join(new_resource.config_directory, "client.rb") do
|
250
|
+
source ::File.expand_path("support/client.erb", __dir__)
|
251
|
+
user new_resource.user unless new_resource.user.nil?
|
252
|
+
group new_resource.group unless new_resource.group.nil?
|
253
|
+
local true
|
254
|
+
variables(
|
255
|
+
chef_license: new_resource.chef_license,
|
256
|
+
chef_server_url: new_resource.chef_server_url,
|
257
|
+
event_loggers: new_resource.event_loggers,
|
258
|
+
exception_handlers: format_handler(new_resource.exception_handlers),
|
259
|
+
file_backup_path: new_resource.file_backup_path,
|
260
|
+
file_cache_path: new_resource.file_cache_path,
|
261
|
+
file_staging_uses_destdir: new_resource.file_staging_uses_destdir,
|
262
|
+
formatters: new_resource.formatters,
|
263
|
+
http_proxy: new_resource.http_proxy,
|
264
|
+
https_proxy: new_resource.https_proxy,
|
265
|
+
ftp_proxy: new_resource.ftp_proxy,
|
266
|
+
log_level: new_resource.log_level,
|
267
|
+
log_location: new_resource.log_location,
|
268
|
+
minimal_ohai: new_resource.minimal_ohai,
|
269
|
+
named_run_list: new_resource.named_run_list,
|
270
|
+
no_proxy: new_resource.no_proxy,
|
271
|
+
node_name: new_resource.node_name,
|
272
|
+
ohai_disabled_plugins: new_resource.ohai_disabled_plugins,
|
273
|
+
ohai_optional_plugins: new_resource.ohai_optional_plugins,
|
274
|
+
pid_file: new_resource.pid_file,
|
275
|
+
policy_group: new_resource.policy_group,
|
276
|
+
policy_name: new_resource.policy_name,
|
277
|
+
report_handlers: format_handler(new_resource.report_handlers),
|
278
|
+
ssl_verify_mode: new_resource.ssl_verify_mode,
|
279
|
+
start_handlers: format_handler(new_resource.start_handlers),
|
280
|
+
additional_config: new_resource.additional_config
|
281
|
+
)
|
282
|
+
mode "0640"
|
283
|
+
action :create
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
action :remove do
|
288
|
+
file ::File.join(new_resource.config_directory, "client.rb") do
|
289
|
+
action :delete
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
action_class do
|
294
|
+
#
|
295
|
+
# Format the handler document in the way we want it presented in the client.rb file
|
296
|
+
#
|
297
|
+
# @param [Hash] a handler property
|
298
|
+
#
|
299
|
+
# @return [Array] Array of handler data
|
300
|
+
#
|
301
|
+
def format_handler(handler_property)
|
302
|
+
handler_data = []
|
303
|
+
|
304
|
+
handler_property.each do |handler|
|
305
|
+
handler_data << "#{handler["class"]}.new(#{handler["arguments"].join(",")})"
|
306
|
+
end
|
307
|
+
|
308
|
+
handler_data
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
@@ -32,23 +32,23 @@ class Chef
|
|
32
32
|
**Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
|
33
33
|
|
34
34
|
```ruby
|
35
|
-
chef_client_cron
|
35
|
+
chef_client_cron 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a cron job'
|
36
36
|
```
|
37
37
|
|
38
38
|
**Run #{ChefUtils::Dist::Infra::PRODUCT} twice a day**:
|
39
39
|
|
40
40
|
```ruby
|
41
|
-
chef_client_cron
|
41
|
+
chef_client_cron 'Run #{ChefUtils::Dist::Infra::PRODUCT} every 12 hours' do
|
42
42
|
minute 0
|
43
|
-
hour
|
43
|
+
hour '0,12'
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
47
47
|
**Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
|
48
48
|
|
49
49
|
```ruby
|
50
|
-
chef_client_cron
|
51
|
-
daemon_options [
|
50
|
+
chef_client_cron 'Run an override recipe' do
|
51
|
+
daemon_options ['--override-runlist mycorp_base::default']
|
52
52
|
end
|
53
53
|
```
|
54
54
|
DOC
|
@@ -30,7 +30,7 @@ class Chef
|
|
30
30
|
**Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
chef_client_scheduled_task
|
33
|
+
chef_client_scheduled_task 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a scheduled task'
|
34
34
|
```
|
35
35
|
|
36
36
|
**Run #{ChefUtils::Dist::Infra::PRODUCT} on system start**:
|
@@ -44,15 +44,15 @@ class Chef
|
|
44
44
|
**Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
chef_client_scheduled_task
|
48
|
-
daemon_options [
|
47
|
+
chef_client_scheduled_task 'Run an override recipe' do
|
48
|
+
daemon_options ['--override-runlist mycorp_base::default']
|
49
49
|
end
|
50
50
|
```
|
51
51
|
|
52
52
|
**Run #{ChefUtils::Dist::Infra::PRODUCT} daily at 01:00 am, specifying a named run-list**:
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
chef_client_scheduled_task
|
55
|
+
chef_client_scheduled_task 'Run chef-client named run-list daily' do
|
56
56
|
frequency 'daily'
|
57
57
|
start_time '01:00'
|
58
58
|
daemon_options ['-n audit_only']
|
@@ -30,22 +30,22 @@ class Chef
|
|
30
30
|
**Setup #{ChefUtils::Dist::Infra::PRODUCT} to run using the default 30 minute cadence**:
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
chef_client_systemd_timer
|
33
|
+
chef_client_systemd_timer 'Run #{ChefUtils::Dist::Infra::PRODUCT} as a systemd timer'
|
34
34
|
```
|
35
35
|
|
36
36
|
**Run #{ChefUtils::Dist::Infra::PRODUCT} every 1 hour**:
|
37
37
|
|
38
38
|
```ruby
|
39
|
-
chef_client_systemd_timer
|
40
|
-
interval
|
39
|
+
chef_client_systemd_timer 'Run #{ChefUtils::Dist::Infra::PRODUCT} every 1 hour' do
|
40
|
+
interval '1hr'
|
41
41
|
end
|
42
42
|
```
|
43
43
|
|
44
44
|
**Run #{ChefUtils::Dist::Infra::PRODUCT} with extra options passed to the client**:
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
chef_client_systemd_timer
|
48
|
-
daemon_options [
|
47
|
+
chef_client_systemd_timer 'Run an override recipe' do
|
48
|
+
daemon_options ['--override-runlist mycorp_base::default']
|
49
49
|
end
|
50
50
|
```
|
51
51
|
DOC
|
@@ -62,7 +62,7 @@ class Chef
|
|
62
62
|
hour '8'
|
63
63
|
weekday '6'
|
64
64
|
mailto 'admin@example.com'
|
65
|
-
command
|
65
|
+
command '/bin/true'
|
66
66
|
action :create
|
67
67
|
end
|
68
68
|
```
|
@@ -76,7 +76,7 @@ class Chef
|
|
76
76
|
day '*'
|
77
77
|
month '11'
|
78
78
|
weekday '1-5'
|
79
|
-
command
|
79
|
+
command '/bin/true'
|
80
80
|
action :create
|
81
81
|
end
|
82
82
|
```
|