From 120cbfd46b79cfec36c17ae6deb7fc51f9094594 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 27 May 2014 15:11:45 -0400 Subject: Switch away from site_config::sshd and instead just include site_sshd The existing site_config::sshd had a non-functioning 'include sshd' line in it that was not doing what was expected (this was supposed to include the sshd module, but due to scoping was including itself). It seemed better to eliminate some of the unused pieces and consolidate into one config location. Change-Id: I79dd904e696ca646180a09abbb03b5361dfc8ab9 --- puppet/modules/site_config/manifests/default.pp | 2 +- puppet/modules/site_config/manifests/sshd.pp | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 puppet/modules/site_config/manifests/sshd.pp (limited to 'puppet/modules/site_config/manifests') diff --git a/puppet/modules/site_config/manifests/default.pp b/puppet/modules/site_config/manifests/default.pp index c7352857..dfdffe03 100644 --- a/puppet/modules/site_config/manifests/default.pp +++ b/puppet/modules/site_config/manifests/default.pp @@ -18,7 +18,7 @@ class site_config::default { include site_config::sysctl # configure ssh and include ssh-keys - include site_config::sshd + include site_sshd # include classes for special environments # i.e. openstack/aws nodes, vagrant nodes diff --git a/puppet/modules/site_config/manifests/sshd.pp b/puppet/modules/site_config/manifests/sshd.pp deleted file mode 100644 index 8ff337a0..00000000 --- a/puppet/modules/site_config/manifests/sshd.pp +++ /dev/null @@ -1,9 +0,0 @@ -class site_config::sshd { - # configure sshd - include sshd - include site_sshd - # no need for configuring authorized_keys as leap_cli cares for that - #$ssh_pubkeys=hiera_hash('ssh_pubkeys') - #notice($ssh_pubkeys) - #create_resources('site_sshd::ssh_key', $ssh_pubkeys) -} -- cgit v1.2.3 From 2f9f76682c02770f47922435f815177ceec15fd9 Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 3 Jun 2014 15:48:35 +0200 Subject: move hiera from site.pp to site_config::setup the problem was following: if a host has the webapp service, the template for /etc/hosts adds some stuff. But setup.pp did not ask hiera about the services so "/srv/leap/bin/puppet_command set_hostname" always resets the hostname. Since that gets triggered every time you run "leap deploy" the hostname changes, some services restart, then the hostname changes back and the services restart again. The solution is to get the hiera data before every run. --- puppet/modules/site_config/manifests/setup.pp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'puppet/modules/site_config/manifests') diff --git a/puppet/modules/site_config/manifests/setup.pp b/puppet/modules/site_config/manifests/setup.pp index 6d89be86..db22c4d9 100644 --- a/puppet/modules/site_config/manifests/setup.pp +++ b/puppet/modules/site_config/manifests/setup.pp @@ -13,6 +13,10 @@ class site_config::setup { include concat::setup include stdlib + + # parse services for host + $services=join(hiera_array('services', ['']), ' ') + notice("Services for ${fqdn}: ${services}") # configure /etc/hosts class { 'site_config::hosts': stage => setup, -- cgit v1.2.3 From 79295764ebbefd346407b8042bc759552aa46234 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 4 Jun 2014 13:05:56 -0700 Subject: bugfix: actually apply modules based on $services --- puppet/modules/site_config/manifests/setup.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'puppet/modules/site_config/manifests') diff --git a/puppet/modules/site_config/manifests/setup.pp b/puppet/modules/site_config/manifests/setup.pp index db22c4d9..01dea723 100644 --- a/puppet/modules/site_config/manifests/setup.pp +++ b/puppet/modules/site_config/manifests/setup.pp @@ -16,7 +16,7 @@ class site_config::setup { # parse services for host $services=join(hiera_array('services', ['']), ' ') - notice("Services for ${fqdn}: ${services}") + # configure /etc/hosts class { 'site_config::hosts': stage => setup, -- cgit v1.2.3 From f991e8a4c877cff1d274fd1cac26488f8c3fda84 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 4 Jun 2014 14:19:55 -0700 Subject: clean up how /etc/hosts is generated so it doesn't require custom behavior depending on the services. --- puppet/modules/site_config/manifests/default.pp | 3 ++- puppet/modules/site_config/manifests/hosts.pp | 16 +++++++++++++--- puppet/modules/site_config/manifests/setup.pp | 5 ----- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'puppet/modules/site_config/manifests') diff --git a/puppet/modules/site_config/manifests/default.pp b/puppet/modules/site_config/manifests/default.pp index dfdffe03..fc2179de 100644 --- a/puppet/modules/site_config/manifests/default.pp +++ b/puppet/modules/site_config/manifests/default.pp @@ -1,6 +1,7 @@ class site_config::default { tag 'leap_base' + $services = hiera('services', []) $domain_hash = hiera('domain') include site_config::params @@ -54,7 +55,7 @@ class site_config::default { # set up core leap files and directories include site_config::files - if $::services !~ /\bmx\b/ { + if ! member($services, 'mx') { include site_postfix::satellite } diff --git a/puppet/modules/site_config/manifests/hosts.pp b/puppet/modules/site_config/manifests/hosts.pp index e5d4dd70..6982d37b 100644 --- a/puppet/modules/site_config/manifests/hosts.pp +++ b/puppet/modules/site_config/manifests/hosts.pp @@ -1,9 +1,19 @@ class site_config::hosts() { $hosts = hiera('hosts', false) + + # calculate all the hostname aliases that might be used $hostname = hiera('name') - $domain_hash = hiera('domain') - $domain_public = $domain_hash['full_suffix'] - $api = hiera('api', '') + $domain_hash = hiera('domain', {}) + $dns = hiera('dns', {}) + if $dns['aliases'] == undef { + $dns_aliases = [] + } else { + $dns_aliases = $dns['aliases'] + } + $my_hostnames = unique(sort(concat( + [$hostname, $domain_hash['full'], $domain_hash['internal']], + $dns_aliases + ))) file { '/etc/hostname': ensure => present, diff --git a/puppet/modules/site_config/manifests/setup.pp b/puppet/modules/site_config/manifests/setup.pp index 01dea723..b09d0413 100644 --- a/puppet/modules/site_config/manifests/setup.pp +++ b/puppet/modules/site_config/manifests/setup.pp @@ -4,7 +4,6 @@ class site_config::setup { # # this is applied before each run of site.pp # - #$services = '' Exec { path => '/usr/bin:/usr/sbin/:/bin:/sbin:/usr/local/bin:/usr/local/sbin' } @@ -13,10 +12,6 @@ class site_config::setup { include concat::setup include stdlib - - # parse services for host - $services=join(hiera_array('services', ['']), ' ') - # configure /etc/hosts class { 'site_config::hosts': stage => setup, -- cgit v1.2.3