[Pacemaker] Using shadow configurations noninteractively

Phil Frost phil at macprofessionals.com
Mon Mar 19 16:00:32 EDT 2012

On Mar 19, 2012, at 15:22 , Florian Haas wrote:
> On Mon, Mar 19, 2012 at 8:00 PM, Phil Frost <phil at macprofessionals.com> wrote:
>> I'm attempting to automate my cluster configuration with Puppet. I'm already using Puppet to manage the configuration of my Xen domains. I'd like to instruct puppet to apply the configuration (via cibadmin) to a shadow config, but I can't find any sure way to do this. The issue is that running "crm_shadow --create ..." starts a subshell, but there's no easy way I can tell puppet to run a command, then run another command in the subshell it creates.
>> Normally I'd expect some command-line option, but I can't find any. It does look like it sets the environment variable "CIB_shadow". Is that all there is to it? Is it safe to rely on that behavior?
> I've never tried this specific use case, so bear with me while I go
> out on a limb, but the crm shell is fully scriptable. Thus you
> *should* be able to generate a full-blown crm script, with "cib foo"
> commands and whathaveyou, in a temporary file, and then just do "crm <
> /path/to/temp/file". Does that work for you?

I don't think so, because the crm shell, unlike cibadmin, has no idempotent method of configuration I've found. With cibadmin, I can generate the configuration for the primitive and associated location constraints for each Xen domain in one XML file, and feed it cibadmin -M as many times as I want without error. I know that by running that command, the resulting configuration is what I had in the file, regardless if the configuration already existed, did not exist, or existed but some parameters were different.

To do this with with crm, I'd have to also write code which checks if things are configured as I want them, then take different actions if it doesn't exist, already exists, or already exists but has the incorrect value. That's not impossible, but it's far harder to develop and quite likely I'll make an error in all that logic that will automate the destruction of my cluster.

More information about the Pacemaker mailing list