Forum: CFEngine Help
Subject: How to manage different types of servers?
Author: linuxgurugamer
Link to topic: https://cfengine.com/forum/read.php?3,26618,26618#msg-26618
We have several different types of servers, which can be grouped into several
main groups. For this discussion, I'll refer to the following:
Group 1: web servers
Group 2: database server
I've been trying to implement a method to have a file on each system identify
which group it belongs in. I'd like to be able to do it this way so that the
CF-engine config won't have to be changed every time we add a new system. I
started using the following method as a precursor to creating a development vs
production environment on the same system.
I found the following post: policy_path.dat selecting config source from
server, but can't seem to get it to work.
So what I've done is to create the following directories on the cfengine server:
/var/cfengine/masterfiles
/var/cfengine/masterfiles-web
/var/cfengine/masterfiles-db
On the destination system, I created a file called: policy_suffix.dat, and put
in the file the desired suffix for the system.
Then, back on the master, I copied the update.cf from teh sample directory, and
modified it as follows:
bundle agent update
{
vars:
"u_workdir" string => "/var/cfengine";
"u_policyhost" string => "192.168.1.158";
"policy_suffix_dat"
comment => "Path to my config on policy host, read from file",
string => readfile("$(u_workdir)/policy_suffix.dat",80);
"master_location" string => "$(u_workdir)/masterfiles$(policy_suffix_dat)";
For now, I just copied the masterfiles directory to masterfiles-web and
masterfiles-db, and made a simple change in a file in each just to see if the
proper files were being downloaded.
I also modified masterfiles/promises.cf as follows:
body common control
{
any::
bundlesequence => {
"update",
"main",
"edit_motd",
};
any::
inputs => {
"update.cf",
"cfengine_stdlib.cf",
"edit_motd.cf",
};
But it never seems to access/copy the files from any directory other than
/var/cfengine/masterfiles
So I know I'm missing something here, and would appreciate pointers in the
right directory.
Also, if there is a better way to manage different types of servers, I'd
appreciate being pointed in that direction as well.
Thanks in advance.
JBB
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine