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# Simple test - copy from a single directory of spec files
26#               generating multiple directories and special
27#               edits.
28#
29########################################################
30
31body common control
32
33{
34      bundlesequence  => { "virtualhosts" };
35      version => "1.2.3";
36}
37
38########################################################
39
40bundle agent virtualhosts
41
42{
43  vars:
44
45
46      "vmbase"        string => "/home/mark/tmp/vm";
47      "source_files"  string => "/home/mark/tmp/src";
48
49      # list of hosts to create
50
51      "hostlist" slist => {
52			    "host1",
53			    "host2",
54			    "host3",
55			    "host4",
56			    "host5",
57			    "host6",
58			    "host7",
59			    "host8",
60			    "host9"
61      };
62
63
64
65
66
67      ################### or just a new file to the dir ################
68      #
69      # "hostlist" slist => { SelectFilesIn("$(source_files)",".*")  }
70      #
71      ##################################################################
72
73  files:
74
75      "$(vmbase)/$(hostlist)/config_for_$(hostlist).vm"
76
77      copy_from => buildvm("$(source_files)/template_$(hostlist)");
78
79
80
81      #
82      # Now edit config .e.g. edit in  $(ipadr[$(hostlist)]) for each
83      #
84
85}
86
87#########################################################
88# library template
89#########################################################
90
91body copy_from buildvm(from)
92
93{
94      source      => "$(from)";
95      copy_backup => "true";                   #/false/timestamp
96}
97
98