Tim Landscheidt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200648

Change subject: WIP: Snapshot
......................................................................

WIP: Snapshot

Bug: T93691
Change-Id: I455538b4a9d5a50a77a0217290dd558d845eb4ad
---
M manifests/role/labs.pp
M modules/base/manifests/resolving.pp
D modules/base/templates/resolv.conf.labs.erb
3 files changed, 46 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/48/200648/1

diff --git a/manifests/role/labs.pp b/manifests/role/labs.pp
index 5db3bed..4d923ee 100644
--- a/manifests/role/labs.pp
+++ b/manifests/role/labs.pp
@@ -140,6 +140,46 @@
         source => 'puppet:///files/nfs/idmapd.conf',
     }
 
+    # On Ubuntu, resolvconf is installed by default; on Debian Jessie
+    # it needs to be installed explicitely.
+    package { 'resolvconf':
+        ensure => installed,
+    }
+
+    # "ndots:2" is necessary to resolve host aliases like
+    # "enwiki.labsdb".
+    file { '/etc/resolvconf/resolv.conf.d/tail':
+        ensure  => file,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        content => "options timeout:5 ndots:2\n",
+        require => Package['resolvconf'],
+    }
+
+    # resolvconf creates this symbolic link at installation time, but
+    # does not overwrite it if it has been replaced for example by
+    # Puppet with a file in the mean time.
+    $resolvconftarget = $::lsbdistcodename ? {
+        'trusty'  => '../run/resolvconf/resolv.conf',
+        'precise' => '../run/resolvconf/resolv.conf',
+        'jessie'  => '/etc/resolvconf/run/resolv.conf',
+    }
+    file { '/etc/resolv.conf':
+        ensure  => link,
+        target  => $resolvconftarget,
+        require => Package['resolvconf'],
+    }
+
+    # Add search domain.
+    file { '/etc/dhcp/dhclient-enter-hooks.d/add-search-domain':
+        ensure  => file,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        content => "new_domain_search=labs.${::site}.wmnet\n",
+    }
+
     # In production, we try to be punctilious about having Puppet manage
     # system state, and thus it's reasonable to purge Apache site configs
     # that have not been declared via Puppet. But on Labs we want to allow
diff --git a/modules/base/manifests/resolving.pp 
b/modules/base/manifests/resolving.pp
index 5592950..435362a 100644
--- a/modules/base/manifests/resolving.pp
+++ b/modules/base/manifests/resolving.pp
@@ -5,13 +5,12 @@
         error("Variable ${::nameservers} is not defined!")
     }
     else {
-        file { '/etc/resolv.conf':
-            owner   => 'root',
-            group   => 'root',
-            mode    => '0444',
-            content => $::realm? {
-                'labs'  => template('base/resolv.conf.labs.erb'),
-                default => template('base/resolv.conf.erb'),
+        if $::realm != 'labs' {
+            file { '/etc/resolv.conf':
+                owner   => 'root',
+                group   => 'root',
+                mode    => '0444',
+                content => template('base/resolv.conf.erb'),
             }
         }
     }
diff --git a/modules/base/templates/resolv.conf.labs.erb 
b/modules/base/templates/resolv.conf.labs.erb
deleted file mode 100644
index 87962fb..0000000
--- a/modules/base/templates/resolv.conf.labs.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-## THIS FILE IS MANAGED BY PUPPET
-##
-## source: modules/base/resolv.conf.labs.erb
-## from:   base::resolving
-
-domain <%= @site %>.wmflabs
-search <%= @site %>.wmflabs labs.<%= @site %>.wmnet
-options timeout:5 ndots:2
-nameserver 10.68.16.1

-- 
To view, visit https://gerrit.wikimedia.org/r/200648
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I455538b4a9d5a50a77a0217290dd558d845eb4ad
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Tim Landscheidt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to