From 113fdb29748f0b175e352304bf158fa19f2a0dfc Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 6 Mar 2018 19:34:34 +0100 Subject: [PATCH] Hiera configures the primary listen interface, no magic ifname lookup anymore Parallels as Vagrant provider ignores "predictable interface names" coming with CentOS7. The VirtualBox provider from Vagrant itself enables this as default with > 1.8.3. Therefore we have `enp0s8` vs `eth1`. Doesn't work reliably, and therefore `hierdata/node/{::fqdn}.yaml` defines the hostonly primary listen interface where needed. This is possible with interpolation in Hiera 5 by doing a reverse lookup() call. fixes #141 --- .puppet/hieradata/common.yaml | 20 ++++++++++--------- ...inga2-elastic.vagrant.demo.icinga.com.yaml | 2 ++ ...inga2-graylog.vagrant.demo.icinga.com.yaml | 1 + ...nga2-influxdb.vagrant.demo.icinga.com.yaml | 1 + ...inga2-master1.vagrant.demo.icinga.com.yaml | 2 ++ ...a2-satellite1.vagrant.demo.icinga.com.yaml | 2 ++ .../node/icinga2.vagrant.demo.icinga.com.yaml | 1 + distributed/Vagrantfile.nodes | 4 ++-- elastic/Vagrantfile.nodes | 2 +- graylog/Vagrantfile.nodes | 2 +- influxdb/Vagrantfile.nodes | 2 +- standalone/Vagrantfile.nodes | 2 +- 12 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 .puppet/hieradata/node/icinga2-elastic.vagrant.demo.icinga.com.yaml create mode 100644 .puppet/hieradata/node/icinga2-graylog.vagrant.demo.icinga.com.yaml create mode 100644 .puppet/hieradata/node/icinga2-influxdb.vagrant.demo.icinga.com.yaml create mode 100644 .puppet/hieradata/node/icinga2.vagrant.demo.icinga.com.yaml diff --git a/.puppet/hieradata/common.yaml b/.puppet/hieradata/common.yaml index 675ec581..78700b12 100644 --- a/.puppet/hieradata/common.yaml +++ b/.puppet/hieradata/common.yaml @@ -1,17 +1,19 @@ --- -icinga::icingaweb2::listen_ip: "%{ipaddress_eth1}" +# node::ipaddress is specified in `node/{::fqdn}.yaml` +# +icinga::icingaweb2::listen_ip: "%{lookup('node::ipaddress')}" icinga::icingaweb2::fqdn: "%{fqdn}" icinga::icinga2::node_name: "%{fqdn}" -graphite::carbon::listen_ip: "%{ipaddress_eth1}" +graphite::carbon::listen_ip: "%{lookup('node::ipaddress')}" graphite::carbon::listen_port: "2003" -graphite::web::listen_ip: "%{ipaddress_eth1}" +graphite::web::listen_ip: "%{lookup('node::ipaddress')}" graphite::web::listen_port: "8003" -influxdb::server::listen_ip: "%{ipaddress_eth1}" +influxdb::server::listen_ip: "%{lookup('node::ipaddress')}" influxdb::server::listen_port: "8086" -grafana::server::listen_ip: "%{ipaddress_eth1}" +grafana::server::listen_ip: "%{lookup('node::ipaddress')}" grafana::server::listen_port: "8004" elastic::elasticsearch::listen_ip: "localhost" @@ -19,12 +21,12 @@ elastic::elasticsearch::listen_port: "9200" elastic::kibana::listen_ip: "localhost" elastic::kibana::listen_port: "5601" -graylog::gelf::listen_ip: "%{ipaddress_eth1}" +graylog::gelf::listen_ip: "%{lookup('node::ipaddress')}" graylog::gelf::listen_port: "12201" -graylog::web::listen_ip: "%{ipaddress_eth1}" -graylog::web::listen_port: "9000" +graylog::web::listen_ip: "%{lookup('node::ipaddress')}" +graylog::web::listen_port: "9000" -#dashing::server::listen_ip: "%{::ipaddress_eth1}" +#dashing::server::listen_ip: "%{lookup('node::ipaddress')}" #dashing::server::listen_port: "8005" # Repos diff --git a/.puppet/hieradata/node/icinga2-elastic.vagrant.demo.icinga.com.yaml b/.puppet/hieradata/node/icinga2-elastic.vagrant.demo.icinga.com.yaml new file mode 100644 index 00000000..901d2d66 --- /dev/null +++ b/.puppet/hieradata/node/icinga2-elastic.vagrant.demo.icinga.com.yaml @@ -0,0 +1,2 @@ +node::ipaddress: "192.168.33.7" + diff --git a/.puppet/hieradata/node/icinga2-graylog.vagrant.demo.icinga.com.yaml b/.puppet/hieradata/node/icinga2-graylog.vagrant.demo.icinga.com.yaml new file mode 100644 index 00000000..71595244 --- /dev/null +++ b/.puppet/hieradata/node/icinga2-graylog.vagrant.demo.icinga.com.yaml @@ -0,0 +1 @@ +node::ipaddress: "192.168.33.6" diff --git a/.puppet/hieradata/node/icinga2-influxdb.vagrant.demo.icinga.com.yaml b/.puppet/hieradata/node/icinga2-influxdb.vagrant.demo.icinga.com.yaml new file mode 100644 index 00000000..1a1735d3 --- /dev/null +++ b/.puppet/hieradata/node/icinga2-influxdb.vagrant.demo.icinga.com.yaml @@ -0,0 +1 @@ +node::ipaddress: "192.168.33.8" diff --git a/.puppet/hieradata/node/icinga2-master1.vagrant.demo.icinga.com.yaml b/.puppet/hieradata/node/icinga2-master1.vagrant.demo.icinga.com.yaml index d6540ad0..30709a99 100644 --- a/.puppet/hieradata/node/icinga2-master1.vagrant.demo.icinga.com.yaml +++ b/.puppet/hieradata/node/icinga2-master1.vagrant.demo.icinga.com.yaml @@ -1,3 +1,5 @@ +node::ipaddress: "192.168.33.101" + icinga::icinga2::zone_name: "master" icinga::icinga2::zones: master: diff --git a/.puppet/hieradata/node/icinga2-satellite1.vagrant.demo.icinga.com.yaml b/.puppet/hieradata/node/icinga2-satellite1.vagrant.demo.icinga.com.yaml index 551b9c39..c83f0504 100644 --- a/.puppet/hieradata/node/icinga2-satellite1.vagrant.demo.icinga.com.yaml +++ b/.puppet/hieradata/node/icinga2-satellite1.vagrant.demo.icinga.com.yaml @@ -1,3 +1,5 @@ +node::ipaddress: "192.168.33.102" + icinga::icinga2::zone_name: "satellite" icinga::icinga2::zones: master: diff --git a/.puppet/hieradata/node/icinga2.vagrant.demo.icinga.com.yaml b/.puppet/hieradata/node/icinga2.vagrant.demo.icinga.com.yaml new file mode 100644 index 00000000..8e3b2b3e --- /dev/null +++ b/.puppet/hieradata/node/icinga2.vagrant.demo.icinga.com.yaml @@ -0,0 +1 @@ +node::ipaddress: "192.168.33.5" diff --git a/distributed/Vagrantfile.nodes b/distributed/Vagrantfile.nodes index 361cb00f..e9024e63 100644 --- a/distributed/Vagrantfile.nodes +++ b/distributed/Vagrantfile.nodes @@ -17,7 +17,7 @@ nodes = { :box_libvirt => 'centos/7', :mac => '020027001000', :net => 'vagrant.demo.icinga.com', - :hostonly => '192.168.33.101', + :hostonly => '192.168.33.101', # keep in sync with hieradata :memory => '1024', :cpus => '2', :forwarded => { @@ -32,7 +32,7 @@ nodes = { :box_libvirt => 'centos/7', :mac => '020027002000', :net => 'vagrant.demo.icinga.com', - :hostonly => '192.168.33.102', + :hostonly => '192.168.33.102', # keep in sync with hieradata :memory => '1024', :cpus => '2', :forwarded => { diff --git a/elastic/Vagrantfile.nodes b/elastic/Vagrantfile.nodes index ac1fbdd8..e882453a 100644 --- a/elastic/Vagrantfile.nodes +++ b/elastic/Vagrantfile.nodes @@ -13,7 +13,7 @@ nodes = { :box_parallels => 'bento/centos-7.4', :box_libvirt => 'centos/7', :net => 'vagrant.demo.icinga.com', - :hostonly => '192.168.33.7', + :hostonly => '192.168.33.7', # keep in sync with hieradata :memory => '2048', :cpus => '2', :mac => '020027000900', diff --git a/graylog/Vagrantfile.nodes b/graylog/Vagrantfile.nodes index 8d17095b..fe9611b4 100644 --- a/graylog/Vagrantfile.nodes +++ b/graylog/Vagrantfile.nodes @@ -13,7 +13,7 @@ nodes = { :box_parallels => 'bento/centos-7.4', :box_libvirt => 'centos/7', :net => 'vagrant.demo.icinga.com', - :hostonly => '192.168.33.6', + :hostonly => '192.168.33.6', # keep in sync with hieradata :memory => '2048', :cpus => '2', :mac => '020027000600', diff --git a/influxdb/Vagrantfile.nodes b/influxdb/Vagrantfile.nodes index b044b1e8..cd43c868 100644 --- a/influxdb/Vagrantfile.nodes +++ b/influxdb/Vagrantfile.nodes @@ -13,7 +13,7 @@ nodes = { :box_parallels => 'bento/centos-7.4', :box_libvirt => 'centos/7', :net => 'vagrant.demo.icinga.com', - :hostonly => '192.168.33.8', + :hostonly => '192.168.33.8', # keep in sync with hieradata :memory => '2048', :cpus => '2', :mac => '020027000199', diff --git a/standalone/Vagrantfile.nodes b/standalone/Vagrantfile.nodes index daec146e..67039a67 100644 --- a/standalone/Vagrantfile.nodes +++ b/standalone/Vagrantfile.nodes @@ -13,7 +13,7 @@ nodes = { :box_parallels => 'bento/centos-7.4', :box_libvirt => 'centos/7', :net => 'vagrant.demo.icinga.com', - :hostonly => '192.168.33.5', + :hostonly => '192.168.33.5', # keep in sync with hieradata :memory => '2048', :cpus => '2', :mac => '020027000500',