From 18bd9b07b06d45891dd5bf1a46633579850e5e62 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 15 Mar 2018 18:10:06 +0100 Subject: Fixed fqdn missing from /etc/hosts --- cmdb/hosts/andromeda.yaml | 1 + cmdb/hosts/collab-jde.yaml | 3 ++- cmdb/hosts/legend.yaml | 1 + services/common.cf | 6 ++++-- templates/common/hosts.cftpl | 5 +++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cmdb/hosts/andromeda.yaml b/cmdb/hosts/andromeda.yaml index 52bce5d..4ecca5d 100644 --- a/cmdb/hosts/andromeda.yaml +++ b/cmdb/hosts/andromeda.yaml @@ -1,3 +1,4 @@ +domain: adyxax.org host_interface: dummy0 host_ip: "10.1.0.255" diff --git a/cmdb/hosts/collab-jde.yaml b/cmdb/hosts/collab-jde.yaml index 3d8064a..e02e571 100644 --- a/cmdb/hosts/collab-jde.yaml +++ b/cmdb/hosts/collab-jde.yaml @@ -1,4 +1,5 @@ -host_interface: dummy0 +domain: adyxax.org +host_interface: br0 host_ip: "10.1.0.253" tunnels: diff --git a/cmdb/hosts/legend.yaml b/cmdb/hosts/legend.yaml index a94400d..46cd451 100644 --- a/cmdb/hosts/legend.yaml +++ b/cmdb/hosts/legend.yaml @@ -1,3 +1,4 @@ +domain: adyxax.org host_interface: dummy0 host_ip: "10.1.0.254" diff --git a/services/common.cf b/services/common.cf index d315c6a..de738a8 100644 --- a/services/common.cf +++ b/services/common.cf @@ -3,9 +3,11 @@ bundle agent common files: any:: "/etc/hosts" - edit_defaults => std_defs, + create => "true", + edit_defaults => empty, perms => system_owned("444"), - copy_from => local_dcp("$(sys.inputdir)/templates/common/hosts.cftpl"), + edit_template => "$(sys.inputdir)/templates/common/hosts.cftpl", + template_method => "cfengine", classes => if_repaired("common_hosts_files_repaired"); reports: any:: diff --git a/templates/common/hosts.cftpl b/templates/common/hosts.cftpl index 23342fd..0b34717 100644 --- a/templates/common/hosts.cftpl +++ b/templates/common/hosts.cftpl @@ -1,9 +1,13 @@ +[%CFEngine BEGIN %] ############################################################################### # \_o< WARNING : This file is being managed by cfengine! >o_/ # # ~~~~ ~~~~ # ############################################################################### 127.0.0.1 localhost +[%CFEngine has_host_data:: %] +$(sys.ipv4) $(sys.uqhost).$(g.host_data[domain]) $(sys.uqhost) +[%CFEngine any:: %] ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix @@ -13643,3 +13647,4 @@ ff02::2 ip6-allrouters # kwadronaut for Windows 7 and Vista information # John Mueller and Lawrence H Smith for Mac Pre-OSX information # Jesse Baird for the Cisco IOS script +[%CFEngine END %] -- cgit v1.2.3