Forum: Cfengine Help
Subject: rather complex scenario (pkg install+configure - if necessary)
Author: ticketo
Link to topic: https://cfengine.com/forum/read.php?3,21557,21557#msg-21557

Hello everyone

I'm looking for help in how to properly do this. Single parts are no problem, 
fitting it all together is.

Actually I just want to do something simple. Install package "mpt-status" on a 
ubuntu host. This is easy. But this package requires a mail transfer agent and 
by default postfix is picked. apt-get is working fine, dependencies are 
resolved, postfix is installed.

But during installation the package want's to know if it's being installed with 
"no config", "internet site", "internet with smarthost" etc.

It is possible to give answers to these questions without asking the user. 
(debconf-set-selections in conjunction with a file containing the answers.)

How do I fit all this together?

So far I'm thinking of something like:
a) write a bundle for mpt-status
b) write a bundle for postfix (which is run before mpt-status)
c) write a bundle postfix_preconf which sets up appropriate answers, so that 
installing the package doesn't require user interaction
d) write a bundle which configures postfix (customizations that are not part of 
preconfigure) & restarts postfix

I could skip c) and force some type of default / minimum config. This would 
also avert the need to somehow skip this step if postfix has been installed 
already. Maybe this is the way to go, since I want full control over installed 
software anyway. This way a 'forced default' configuration is just something 
that deviates from the required/requested configuration. Doesn't make that much 
of a difference if the config diverts because of user or software changes.

At the moment I don't see how I can introduce some kind of dependency. It would 
be really nice if postfix is installed and configured _only_ if someone 
actually needs a MTA. (On most systems I don't.) It probably works by defining 
a class somewhere beforehand.

Maybe it should go something like this

1) Detection: This is "hardware" -> install raid controller monitoring software 
(megacli, mpt-status, compaqarrayd,...)
2) Preparation: In order to install $foo, $bar and $baz is required
3) Install $bar, $baz
4) Install monitoring software

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to