/
motd.cf
42 lines (34 loc) · 1 KB
/
motd.cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
body common control
{
bundlesequence => { "edit_motd" };
}
bundle agent edit_motd
{
files:
"/etc/motd"
edit_line => my_motd,
edit_defaults => empty,
create => "true";
}
#@ The bundle `my_motd` and body `empty` detail what content we want
#@ in the file using CFEngine's built-in line-editor.
bundle edit_line my_motd
{
vars:
"interfaces_str" string => join(", ","sys.interfaces");
"ipaddresses_str" string => join(", ","sys.ip_addresses");
insert_lines:
"Welcome to $(sys.fqhost)!
This system is managed by CFEngine.
The policy was last updated on $(sys.last_policy_update).
The system has $(sys.cpus) cpus.
Network interfaces on this system are $(interfaces_str),
and the ip-addresses assigned are $(ipaddresses_str).";
}
#@ The `my_motd` bundle describes the content we want.
body edit_defaults empty
{
empty_file_before_editing => "true";
}
#@ Baseline memory model of file to zero/empty before
#@ populating the model using edit_line my_motd