I have a recipe which copies a secret_key to my node. Actually the file content is logged into my shell. I want to turn that off for this single recipe, because I don't want the file content to be saved into my shell history. I know that it's possible to completely deactivate the logging with the verbose_logging setting in client.rb.
verbose_logging: Set the log level. Options: true, nil, and false. When this is set to false, notifications about individual resources being processed are suppressed (and are output at the :info logging level). Setting this to false can be useful when a chef-client is run as a daemon. Default value: nil.
But is it possible to deactivate the logging only for a single recipe?
Stops and disables chef-client systemd unit: sudo systemctl stop chef-client and sudo systemctl disable chef-client. Overrides /usr/bin/chef-client with a shell script emitting the log message, its timestamp, and the user who logged it.
Use the breakpoint resource to add breakpoints to recipes. Run the chef-shell in chef-client mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the chef-client during an actual chef-client run.
There is a common property called sensitive
, which will
Ensure that sensitive resource data is not logged by the chef-client. Default value: false. This property only applies to the execute, file and template resources.
template "/etc/my.secret" do
sensitive true
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With