puppet-wp/manifests/cap.pp
2019-09-03 18:59:18 +10:00

30 lines
602 B
Puppet

# A class for WP-CLI's cap commands.
define wp::cap (
$location,
$ensure = present,
$role,
$cap,
$grant = true,
$user = $::wp::user,
$onlyif = '/usr/bin/wp core is-installed',
) {
include wp::cli
case $ensure {
present: {
$command = "add ${role} ${cap} --grant=${grant}"
}
absent: {
$command = "remove ${role} ${cap}"
}
default: {
fail( 'Invalid attribute for wp::cap' )
}
}
wp::command { "${location} cap ${command}":
location => $location,
command => "cap ${command}",
user => $user,
onlyif => $onlyif,
}
}