mirror of
https://ghproxy.net/https://github.com/Chassis/puppet-wp.git
synced 2026-07-29 13:38:00 +08:00
22 lines
602 B
Puppet
22 lines
602 B
Puppet
# Create a type for "wp site create"
|
|
define wp::create_subsite (
|
|
$aliases,
|
|
$location,
|
|
) {
|
|
# Generate the slugs for the subsites.
|
|
if ( $name != $aliases[0] ) {
|
|
$slug = regsubst( $name, ".${aliases[0]}", '')
|
|
}
|
|
|
|
if ( $slug ) {
|
|
exec { "wp site create --slug=${slug}":
|
|
cwd => $location,
|
|
user => $::wp::user,
|
|
command => "${wp::params::bin_path}/wp site create --slug=${slug}",
|
|
unless => "${wp::params::bin_path}/wp site list | grep ${slug}",
|
|
require => Class['wp::cli'],
|
|
onlyif => "${wp::params::bin_path}/wp core is-installed",
|
|
logoutput => true
|
|
}
|
|
}
|
|
}
|