1# Copyright 2020 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 server connection to cfServer 26# 27######################################################## 28 29# 30# run this as follows: 31# 32# cf-serverd -f runtest_1.cf [-d2] 33# cf-agent -f runtest_2.cf 34# 35# Notice that the same file configures all parts of cfengine 36 37######################################################## 38 39body common control 40 41{ 42 bundlesequence => { "example" }; 43 version => "1.2.3"; 44} 45 46######################################################## 47 48bundle agent example 49 50{ 51 files: 52 53 "/home/mark/tmp/testflatcopy" 54 55 comment => "test copy promise", 56 copy_from => mycopy("/home/mark/LapTop/words","127.0.0.1"), 57 perms => system, 58 depth_search => recurse("inf"), 59 classes => satisfied("copy_ok"); 60 61 62 "/home/mark/tmp/testcopy/single_file" 63 64 comment => "test copy promise", 65 copy_from => mycopy("/home/mark/LapTop/Cfengine3/trunk/README","127.0.0.1"), 66 perms => system; 67 68 reports: 69 70 copy_ok:: 71 72 "Files were copied.."; 73} 74 75######################################################### 76 77body perms system 78 79{ 80 mode => "0644"; 81} 82 83######################################################### 84 85body depth_search recurse(d) 86 87{ 88 depth => "$(d)"; 89} 90 91######################################################### 92 93body copy_from mycopy(from,server) 94 95{ 96 source => "$(from)"; 97 servers => { "$(server)" }; 98 compare => "digest"; 99 verify => "true"; 100 copy_backup => "true"; #/false/timestamp 101 purge => "false"; 102 type_check => "true"; 103 force_ipv4 => "true"; 104 trustkey => "true"; 105 collapse_destination_dir => "true"; 106} 107 108######################################################### 109 110body classes satisfied(x) 111{ 112 promise_repaired => { "$(x)" }; 113 persist_time => "0"; 114} 115 116######################################################### 117# Server config 118######################################################### 119 120body server control 121 122{ 123 allowconnects => { "127.0.0.1" , "::1" }; 124 allowallconnects => { "127.0.0.1" , "::1" }; 125 trustkeysfrom => { "127.0.0.1" , "::1" }; 126} 127 128######################################################### 129 130bundle server access_rules() 131 132{ 133 access: 134 135 "/home/mark/LapTop" 136 137 admit => { "127.0.0.1" }; 138} 139