From fae64e791f1dd87d68c712ba4cf44a09b2d545a5 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 25 Jul 2017 15:52:45 +0200 Subject: Added /etc/hosts management --- services/common.cf | 13 +++++++++++++ services/main.cf | 7 ++++++- templates/common/hosts | 26 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 services/common.cf create mode 100644 templates/common/hosts diff --git a/services/common.cf b/services/common.cf new file mode 100644 index 0000000..8ca7a3d --- /dev/null +++ b/services/common.cf @@ -0,0 +1,13 @@ +bundle agent common +{ + files: + any:: + "/etc/hosts" + edit_defaults => std_defs, + perms => system_owned("444"), + edit_template => "$(sys.inputdir)/templates/common/hosts", + classes => if_repaired("hosts_repaired"); + reports: + any:: + "$(this.bundle): /etc/hosts repaired" ifvarclass => "hosts_repaired"; +} diff --git a/services/main.cf b/services/main.cf index a1bea6d..2abefb9 100644 --- a/services/main.cf +++ b/services/main.cf @@ -8,8 +8,13 @@ bundle common classify { vars: - "bundles" slist => { "debian", "ubuntu" }; + "bundles" slist => { + "common", + "debian", + "ubuntu", + }; "inputs" slist => { + "services/common.cf", "services/debian.cf", "services/ubuntu.cf", }; diff --git a/templates/common/hosts b/templates/common/hosts new file mode 100644 index 0000000..1438f8d --- /dev/null +++ b/templates/common/hosts @@ -0,0 +1,26 @@ +############################################################################### +# \_o< WARNING : This file is being managed by cfengine! >o_/ # +# ~~~~ ~~~~ # +############################################################################### +127.0.0.1 localhost + +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters + +10.1.0.200 tiddlywiki +10.1.0.201 phpipam +10.1.0.202 check_mk +10.1.0.203 miniflux +10.1.0.204 hub +10.1.0.205 bareos +10.1.0.206 packages +10.1.0.207 webmail + +10.1.0.251 reality +10.1.0.252 hurricane +10.1.0.253 collab +10.1.0.254 legend +10.1.0.255 andromeda -- cgit v1.2.3