1#  Copyright 2021 Northern.tech AS
2
3#  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
4
5#  This program is free software; you can redistribute it and/or modify it
6#  under the terms of the GNU General Public License as published by the
7#  Free Software Foundation; version 3.
8
9#  This program is distributed in the hope that it will be useful,
10#  but WITHOUT ANY WARRANTY; without even the implied warranty of
11#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12#  GNU General Public License for more details.
13
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
17
18# To the extent this program is licensed as part of the Enterprise
19# versions of Cfengine, the applicable Commercial Open Source License
20# (COSL) may apply to this file if you as a licensee so wish it. See
21# included file COSL.txt.
22
23#######################################################
24#
25# Apache 2 reconfig - modelled on SuSE
26#
27#######################################################
28
29body common control
30
31{
32    any::
33
34      bundlesequence  => {
35			   apache
36      };
37}
38
39#######################################################
40
41bundle agent apache
42
43{
44  files:
45
46      "/home/mark/tmp/apache2" #  "/etc/sysconfig/apache2"
47
48      edit_line => fixapache;
49}
50
51#######################################################
52# For the library
53#######################################################
54
55bundle edit_line fixapache
56
57{ # Values have the form NAME = "quoted space separated list"
58
59  vars:
60
61      "add_modules"     slist => {
62				   "dav",
63				   "dav_fs",
64				   "ssl",
65				   "php5",
66				   "dav_svn",
67				   "xyz",
68				   "superduper"
69      };
70
71      "del_modules"     slist => {
72				   "php3",
73				   "jk",
74				   "userdir",
75				   "imagemap",
76				   "alias"
77      };
78
79  insert_lines:
80
81      "APACHE_CONF_INCLUDE_FILES=\"/site/masterfiles/local-http.conf\"";
82
83  field_edits:
84
85      #####################################################################
86      # APACHE_MODULES="authz_host actions alias auth_basic dav dav_fs imagemap ssl php5 dav_svn authz_default jk"
87      #####################################################################
88
89      "APACHE_MODULES=.*"
90
91      # Insert module "columns" between the quoted RHS
92      # using space separators
93
94      edit_field => quotedvar("$(add_modules)","append");
95
96      "APACHE_MODULES=.*"
97
98      # Delte module "columns" between the quoted RHS
99      # using space separators
100
101      edit_field => quotedvar("$(del_modules)","delete");
102
103      # if this line already exists, edit it
104}
105
106########################################
107# Bodies
108########################################
109
110body edit_field quotedvar(newval,method)
111
112{
113      field_separator => "\"";
114      select_field    => "2";
115      value_separator  => " ";
116      field_value     => "$(newval)";
117      field_operation => "$(method)";
118      extend_fields => "false";
119      allow_blank_fields => "true";
120}
121
122