Open kadamwhite opened 5 years ago
We discussed this a bit in Slack, but to go into a bit further detail here:
Puppet is entirely declarative, so there's no concept of if x, do y
(apart from compile-time things), generally speaking. Instead, you say how you want the universe to look, and Puppet works out the internals.
For something like this, what you'd want to generally do is have a resource like:
define wxr::content(
$path = $title,
) {
# ...
}
Internally, this would then work out how to make the universe match the declared state. You can break out into Ruby if you want to.
Without doing that, you'd want something like this:
wp::plugin { 'wordpress-importer':
ensure => enabled,
require => Chassis::Wp[ $config['hosts'][0] ],
}
if $config[wxr][clean] == true {
wp::command { 'site empty':
before => Wp::Command["import $wxr_path"],
require => Wp::Plugin['wordpress-importer'],
}
}
wp::command { "import $wxr_path":
require => Wp::Plugin['wordpress-importer'],
}
(wp::command
will only run if it's already installed)
Tagging @rmccue because after yesterday, I think I don't get along well at all with Puppet (and especially the Puppet docs). An outside opinion would be helpful.
We can't run an import unless the Importer plugin is installed and active.
puppet-wp
doesn't seem to let me useunless
oronlyif
on any of its exposed tasks, so chaining appears to be the only way I can ensure that this occurs. Right now we're doing this (simplified for brevity):Is this the best way to achieve this? What I want to be able to do is to say,
I feel this should be achievable but nothing I can determine about this $@%$%! piece of trash configuration management tool explains in human-readable terms how to make it happen.
(Ansible, if you're out there watching, :two_hearts:. I miss you. Come home.)