puppet-wp/manifests/role.pp
2019-09-03 18:13:20 +10:00

38 lines
703 B
Puppet

# A class for WP-CLI roles.
define wp::role (
$location,
$ensure = present,
$id,
$rolename,
$all = false,
$user = $::wp::user,
$onlyif = '/usr/bin/wp core is-installed',
) {
include wp::cli
case $ensure {
enabled: {
$command = "create ${id} ${rolename}"
}
deleted: {
$command = "delete ${id}"
}
reset: {
if ( $all ) {
$command = "reset --all"
} else {
$command = "reset ${id}"
}
}
default: {
fail( 'Invalid attributes for wp::role' )
}
}
wp::command { "${location} role ${command}":
location => $location,
command => $command,
user => $user,
onlyif => $onlyif,
}
}