On 24/11/17 16:09, mattf...@gmail.com wrote:
Hi, this looks like lots of code and could be more efficient (Zesty & Xenial )?


You have quite a lot of repetition - you can fix that by using
a default section for your resources. It is a bit of work to find
all repeated settings so I am only showing it in principle:

$xenial_defaults = {
 release    => 'xenial',
 repos      => ['main', 'restricted'],
 with_udebs => true,
 key        => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
 # and so on...
}

$mirrors = {
 'xenial_main' => $xenial_defaults + {
   # keys that differ or additional keys
 },
 'xenial_main_updates' => $xenial_defaults + {
   'release' => 'xenial-updates',
   # keys that differ or additional keys
 },
 # etc, etc
}

- henrik



Thanks for your support !

    $mirrors         = {
         'xenial_main' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'xenial',
           repos         => ['main', 'restricted'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_main_updates' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'xenial-updates',
           repos         => ['main', 'restricted'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_universe' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'xenial',
           repos         => ['universe'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_universe_updates' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'xenial-updates',
           repos         => ['universe'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_multiverse' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'xenial',
           repos         => ['multiverse'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_multiverse_updates' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'xenial-updates',
           repos         => ['multiverse'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_backports' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'xenial-backports',
           repos         => ['main','restricted','universe','multiverse'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_security' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'xenial-security',
           repos         => ['main','restricted'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_security' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'xenial-security',
           repos         => ['main','restricted'],
           architectures => ['i386','amd64'],
           key           => [],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_security_universe' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'xenial-security',
           repos         => ['universe'],
           architectures => ['i386','amd64'],
           key           => [],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_security_multiverse' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'xenial-security',
           repos         => ['multiverse'],
           architectures => ['i386','amd64'],
           key           => [],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'xenial_yarn'   => {
           location      => 'https://dl.yarnpkg.com/debian/',
           release       => 'stable',
           repos         => ['main'],
           architectures => ['amd64'],
           key           => ['72ECF46A56B4AD39C907BBB71646B01B86E50310'],
           keyserver     => 'hkp://p80.pool.sks-keyservers.net:80',
         },
         'xenial_puppet'   => {
           location      => 'http://apt.puppetlabs.com/',
           release       => 'xenial',
           repos         => ['PC1'],
           architectures => ['amd64'],
           key           => ['6F6B15509CF8E59E6E469F327F438280EF8D349F'],
           keyserver     => 'hkp://p80.pool.sks-keyservers.net:80',
         },
         'zesty_puppet'  => {
           location      => 'http://apt.puppetlabs.com/',
           release       => 'zesty',
           repos         => ['PC1'],
           architectures => ['amd64'],
           key           => ['6F6B15509CF8E59E6E469F327F438280EF8D349F'],
           keyserver     => 'hkp://p80.pool.sks-keyservers.net:80',
         },
         'zesty_yarn'   => {
           location      => 'https://dl.yarnpkg.com/debian/',
           release       => 'stable',
           repos         => ['main'],
           architectures => ['amd64'],
           key           => ['72ECF46A56B4AD39C907BBB71646B01B86E50310'],
           keyserver     => 'hkp://p80.pool.sks-keyservers.net:80',
         },
         'zesty_security_multiverse' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'zesty-security',
           repos         => ['multiverse'],
           architectures => ['i386','amd64'],
           key           => [],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_security_universe' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'zesty-security',
           repos         => ['universe'],
           architectures => ['i386','amd64'],
           key           => [],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_security' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'zesty-security',
           repos         => ['main','restricted'],
           architectures => ['i386','amd64'],
           key           => [],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_security' => {
           location      => 'http://security.ubuntu.com/ubuntu',
           release       => 'zesty-security',
           repos         => ['main','restricted'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_backports' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'zesty-backports',
           repos         => ['main','restricted','universe','multiverse'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_multiverse_updates' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'zesty-updates',
           repos         => ['multiverse'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_multiverse' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'zesty',
           repos         => ['multiverse'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_universe_updates' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'zesty-updates',
           repos         => ['universe'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_universe' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'zesty',
           repos         => ['universe'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_main' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'zesty',
           repos         => ['main', 'restricted'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         },
         'zesty_main_updates' => {
           location      => 'http://de.archive.ubuntu.com/ubuntu',
           release       => 'zesty-updates',
           repos         => ['main', 'restricted'],
           architectures => ['i386','amd64'],
           key           => ['40976EAF437D05B5','3B4FE6ACC0B21F32'],
           keyserver     => 'keyserver.ubuntu.com',
           with_udebs    => true,
         }
       }

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com <mailto:puppet-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/40f88e69-16b8-43b0-8898-5432fdada291%40googlegroups.com <https://groups.google.com/d/msgid/puppet-users/40f88e69-16b8-43b0-8898-5432fdada291%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ov9hcv%24ns3%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to