Make syncproxy mirror basedir configurable in hiera, and use it in all templates...
authorPeter Palfrader <peter@palfrader.org>
Tue, 12 Sep 2017 08:39:10 +0000 (08:39 +0000)
committerPeter Palfrader <peter@palfrader.org>
Tue, 12 Sep 2017 08:39:10 +0000 (08:39 +0000)
hieradata/common.yaml
hieradata/nodes/mirror-conova.debian.org.yaml [new file with mode: 0644]
modules/debian_org/lib/facter/paths.rb
modules/puppetmaster/files/hiera.yaml
modules/roles/manifests/syncproxy.pp
modules/roles/templates/syncproxy/rsyncd.conf.erb
modules/roles/templates/syncproxy/syncproxy.debian.org-apache.erb
modules/roles/templates/syncproxy/syncproxy.debian.org-index.html.erb

index d15c91d..b0cbf20 100644 (file)
@@ -3,6 +3,9 @@ nameservers: []
 searchpaths: []
 resolvoptions: []
 allow_dns_query: []
+role_config:
+  syncproxy:
+    mirror_basedir_prefix: '/srv/mirrors/'
 roles:
   bugsmx:
     - buxtehude.debian.org
@@ -184,6 +187,7 @@ roles:
     - klecker.debian.org
     - milanollo.debian.org
     - mirror-anu.debian.org
+    - mirror-conova.debian.org
     - mirror-isc.debian.org
     - mirror-umn.debian.org
   tracker:
diff --git a/hieradata/nodes/mirror-conova.debian.org.yaml b/hieradata/nodes/mirror-conova.debian.org.yaml
new file mode 100644 (file)
index 0000000..9dfe28f
--- /dev/null
@@ -0,0 +1,3 @@
+role_config:
+  syncproxy:
+    mirror_basedir_prefix: '/srv/mirrors/syncproxy-'
index ccc4588..ad4e984 100644 (file)
@@ -6,6 +6,10 @@
    /srv/mirrors/debian-debug
    /srv/mirrors/debian-ports
    /srv/mirrors/debian-security
+   /srv/mirrors/syncproxy-debian
+   /srv/mirrors/syncproxy-debian-debug
+   /srv/mirrors/syncproxy-debian-ports
+   /srv/mirrors/syncproxy-debian-security
    /dev/hwrng
 }.each do |path|
        Facter.add("has" + path.gsub(/[\/-]/,'_')) do
index 216f65f..b7a09f8 100644 (file)
@@ -1,5 +1,6 @@
 ---
 :hierarchy:
+  - 'nodes/%{trusted.certname}'
   - '%{hoster}'
   - 'clusters/%{cluster}'
   - 'common'
index 0c1d993..3b4816d 100644 (file)
@@ -1,9 +1,12 @@
 class roles::syncproxy {
        include roles::archvsync_base
 
+       $mirror_basedir_prefix = hiera('role_config.syncproxy.mirror_basedir_prefix')
+
        $binds = $::hostname ? {
                'milanollo'    => [ '5.153.231.9', '[2001:41c8:1000:21::21:9]' ],
                'mirror-anu'   => [ '150.203.164.60', '[2001:388:1034:2900::3c]' ],
+               'mirror-conova' => [ '217.196.149.237', '[2a02:16a8:dc41:100::237]' ],
                'mirror-isc'   => [ '149.20.4.16', '[2001:4f8:1:c::16]' ],
                'mirror-umn'   => [ '128.101.240.216', '[2607:ea00:101:3c0b::1deb:216]' ],
                'klecker'      => [ '130.89.148.10', '[2001:610:1908:b000::148:10]',
@@ -14,6 +17,7 @@ class roles::syncproxy {
        $syncproxy_name = $::hostname ? {
                'milanollo' => 'syncproxy3.eu.debian.org',
                'mirror-anu' => 'syncproxy.au.debian.org',
+               'mirror-conova' => 'syncproxy4.eu.debian.org',
                'mirror-isc' => 'syncproxy2.wna.debian.org',
                'mirror-umn' => 'syncproxy.cna.debian.org',
                'klecker' => 'syncproxy2.eu.debian.org',
index 14a6d07..37c8f7f 100644 (file)
@@ -12,44 +12,43 @@ read only = true
 ignore nonreadable = true
 strict modes = false
 
-[debian]
-  path = /srv/mirrors/debian/
-<%- unless has_variable?("has_srv_mirrors_debian") && @has_srv_mirrors_debian -%>
-  list = no
-<%- end -%>
-  comment = Debian archive (contact mirrors@debian.org for access; see https://www.debian.org/mirror/size for size)
-  auth users = *
-  secrets file = /home/archvsync/rsyncd/debian.secrets
+<%=
+ repositories = [
+  { name: 'debian',
+    comment: 'Debian archive (contact mirrors@debian.org for access; see https://www.debian.org/mirror/size for size)'
+  },
+  { name: 'debian-debug',
+    comment: 'Debug packages for Debian archive (contact mirrors@debian.org for access)'
+  },
+  { name: 'debian-ports',
+    comment: 'Debian ports archive (contact mirrors@debian.org for access)'
+  },
+  { name: 'debian-security',
+    comment: 'Debian security archive'
+  },
+  { name: 'debian-security-buildd-pool',
+    list: false
+  },
+  ]
 
-[debian-debug]
-  path = /srv/mirrors/debian-debug/
-<%- unless has_variable?("has_srv_mirrors_debian_debug") && @has_srv_mirrors_debian_debug -%>
-  list = no
-<%- end -%>
-  comment = Debug packages for Debian archive (contact mirrors@debian.org for access)
-  auth users = *
-  secrets file = /home/archvsync/rsyncd/debian-debug.secrets
+  lines = []
 
-[debian-ports]
-  path = /srv/mirrors/debian-ports/
-<%- unless has_variable?("has_srv_mirrors_debian_debug") && @has_srv_mirrors_debian_debug -%>
-  list = no
-<%- end -%>
-  comment = Debian ports archive (contact mirrors@debian.org for access)
-  auth users = *
-  secrets file = /home/archvsync/rsyncd/debian-ports.secrets
+  repositories.each do |repo|
+    varname = ('has' + @mirror_basedir_prefix + repo[:name]).gsub(/[\/-]/,'_')
+    next unless has_variable?(varname) and (eval("@"+varname))
 
-[debian-security]
-  path = /srv/mirrors/debian-security/
-<%- unless has_variable?("has_srv_mirrors_debian_security") && @has_srv_mirrors_debian_security -%>
-  list = no
-<%- end -%>
-  comment = Debian security archive (contact mirrors@debian.org for access)
-  auth users = *
-  secrets file = /home/archvsync/rsyncd/debian-security.secrets
+    lines << "[#{ repo[:name] }]"
+    lines << "  path = #{ @mirror_basedir_prefix }#{ repo[:name] }/"
+    if (repo.include?(:list) and not repo[:list])
+      lines << "  list = no"
+    end
+    if repo.include?(:comment)
+      lines << "  comment = #{ repo[:comment] }"
+    end
+    lines << "  auth users = *"
+    lines << "  secrets file = /home/archvsync/rsyncd/#{ repo[:name] }.secrets"
+    lines << ""
+  end
 
-[debian-security-buildd-pool]
-  path = /srv/mirrors/debian-security-buildd/pool/
-  list = no
-  auth users = *
-  secrets file = /home/archvsync/rsyncd/debian-security-buildd-pool.secrets
+  lines.join("\n")
+%>
index eb59b0c..ab4ca59 100644 (file)
 <%=
 lines = []
 %w{debian debian-debug debian-ports debian-security}.each do |archive|
-  varname = 'has_srv_mirrors_' + archive.gsub(/[\/-]/,'_')
+  varname = ('has' + @mirror_basedir_prefix + archive).gsub(/[\/-]/,'_')
   if has_variable?(varname) and (eval("@"+varname))
-    lines << "  Alias /#{archive}/project/trace/ /srv/mirrors/#{archive}/project/trace/"
-    lines << "  <Directory /srv/mirrors/#{archive}/project/trace/>"
+    lines << "  Alias /#{archive}/project/trace/ #{@mirror_basedir_prefix}#{archive}/project/trace/"
+    lines << "  <Directory #{@mirror_basedir_prefix}#{archive}/project/trace/>"
     lines << "    Require all granted"
     lines << "    Options +Indexes"
     lines << "  </Directory>"
index ef9fdfc..4d16f1b 100644 (file)
@@ -19,7 +19,7 @@ This syncproxy contains copies of the following archives.
 <%=
 lines = []
 %w{debian debian-debug debian-ports debian-security}.each do |archive|
-  varname = 'has_srv_mirrors_' + archive.gsub(/[\/-]/,'_')
+  varname = ('has' + @mirror_basedir_prefix + archive).gsub(/[\/-]/,'_')
   if has_variable?(varname) and (eval("@"+varname))
     lines << "<li>#{archive} [<a href=\"/#{archive}/project/trace/\">trace directory</a>]</li>"
   end