Resource Type: validation
- Defined in:
- lib/puppet/type/validation.rb
- Providers:
-
posix
Overview
This type allows you to validate settings on your system. Here is an example on how you can use this:
validation { "Validate root user is uid 0":
check => '/usr/bin/grep -e "^root" /etc/passwd',
expected_output => /root:x:0:0:root:\/root:\/bin\/bash/,
report_as => 'command',
fail_message => "User root not defined with uid 1 valdation output is: '%<output>s'",
fail_command => "/bin/send_to_montoring --node ${::fqdn} %<output>s",
}
This Puppet code executes the check ‘/bin/grep…` on your system and validates that the output equals the regular expression `/root.…/`. If it passes, Puppet does nothing. Because `report_as` is set to `command`, when the check fails, Puppet will execute the `fail_command` and pass in the `fail_message` text.