Skip to content

Instantly share code, notes, and snippets.

@deviantintegral
Created April 29, 2013 18:47
Show Gist options
  • Save deviantintegral/5483766 to your computer and use it in GitHub Desktop.
Save deviantintegral/5483766 to your computer and use it in GitHub Desktop.
Setting apt config before running apt.
diff --git a/manifests/nodes.pp b/manifests/nodes.pp
index 66dc1a1..e18d6c9 100644
--- a/manifests/nodes.pp
+++ b/manifests/nodes.pp
@@ -31,11 +31,46 @@ class rome::onehost {
}
}
+stage { 'first':
+ before => Stage['main'],
+}
+
+class apt-proxy {
+ if $apt_proxy {
+ file { "/etc/apt/apt.conf.d/71proxy":
+ owner => root,
+ group => root,
+ mode => '0644',
+ content => "Acquire::http { Proxy \"${apt_proxy}\"; };",
+ }
+ }
+ else {
+ file { "/etc/apt/apt.conf.d/71proxy":
+ ensure => absent,
+ }
+ }
+
+ file { 'etc apt confs':
+ path => '/etc/apt/apt.conf.d',
+ source => '/vagrant/files/common/etc/apt/apt.conf.d',
+ recurse => true,
+ owner => 'root',
+ group => 'root',
+ }
+}
+
# VM configuration that should be included in all VMs.
class rome {
include base
+
+ class { 'apt-proxy':
+ stage => first,
+ }
+
class { 'apt':
always_apt_update => true,
+ require => File[ "/etc/apt/apt.conf.d/71proxy" ],
+ stage => 'first',
}
package {'htop':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment