Il 29/10/2011 17:30, no-re...@cfengine.com ha scritto:
> Well, if we are talking edit files,

We do, sorry if it wasn't evident. I thought it was clear when
mentioning templates and conditionally adding stuff to a file.

Let me break down the problem, so that it will be easier to understand
why I am not seeing how to solve it with cfengine.

1) I am trying to create an ntp.conf, whose contents will be generated
depending on a number of conditions, and some combinations of them

2) the first part of the file is a header; this is simple as it contains
only scalars, and they can be easily expanded

3) then, if this machine will use multicast NTP, we'll have a "keys"
directive, pointing to the keyring, and a "trustedkey" directive which
will list which keys we trust among those in the keyring

4) I'll add a "disable kernel" directive if needed

5) if either the machine is a server of any type (unicast or multicast),
or it is an unicast client, I'll need to generate a "server" directive
for each of the configured upstream servers;

6) if the machine is a server of any type and a number of peers was
configured, we'll also need to generate a "peer" directive for each one
of those;

7) if this is a multicast server, we need to add a "broadcast"
directive, which must contain a "key" option with the host's key number;

8) if this is a multicast client, we need to add a "multicastclient"
directive.

9) then "restrict" rules will come, with slightly different options if a
machine is a mutlicastclient or not (you'll add a "notrust" to the
default ones, basically).

10) last but not least, cfengine must be able to selectively make
changes the relevant lines in case it is needed, e.g.:

- a new key must be trusted, be it an additional one, or replacing
another one

- if we change one of the upstream servers, the old one must be replaced
by the new one


Among others, the following I don't see, among others, are:

- how I can do 2-10 in a single promise, or

- how I can break down 2-10 in multiple promises consistently

- how I can combine this all with the limited templating functionalities
in cfengine

- how I can do 6) --generate those lines only if a list is defined

- most of all, I really don't see how I can do 2-10 in a way that a
change in the configuration results in a change in a specific point of a
line instead of, e.g., duplicating lines containing old and new directives


> If I get time, I'll make an example of this tomorrow. 

That would help a lot, thanks.

I am probably too new to cfengine3. I started cfengine3 only a few weeks
ago (I've been a cfengine2 and puppet user in the past). The amount of
information one needs to know before being productive is overwhelming,
so please bear with me if my questions are trivial, or if their answers
are in a document I wasn't aware of.

Thanks a lot
-- bronto
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to