Ubuntu Network Proxy via Puppet

121 views
Skip to first unread message

steven...@imemories.com

unread,
Jan 29, 2014, 4:05:00 PM1/29/14
to puppet...@googlegroups.com
So we have hit a wall pretty hard here:

We have a series of Ubuntu Desktops running 12.04 LTS and we've configured puppet to do enable to Network Proxy and it does the weirdest thing.  It will refuse to set the proxy until we do an initial setting in the GUI.  (Gnome Desktop) Here's our config (some info redacted) but has anyone else figured out a fix for this?



file { "environment":
    path    => "/etc/environment",
    ensure  => present,
    mode    => 755,
    owner   => root,
    group   => root,
    source  => "puppet:///modules/linuxdesktop_squid/environment",
  }
exec { 'dbus proxy 1':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "dbus-launch gsettings set org.gnome.system.proxy mode 'manual' ",
  }
exec { 'dbus proxy 2':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "dbus-launch gsettings set org.gnome.system.proxy.http host 'xxx.xxx.xxx.xxxfile { "environment":
    path    => "/etc/environment",
    ensure  => present,
    mode    => 755,
    owner   => root,
    group   => root,
    source  => "puppet:///modules/linuxdesktop_squid/environment",
  }
exec { 'dbus proxy 1':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "dbus-launch gsettings set org.gnome.system.proxy mode 'manual' ",
  }
exec { 'dbus proxy 2':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "dbus-launch gsettings set org.gnome.system.proxy.http host 'xxx.xxx.xxx.xxx'",
  }
exec { 'dbus proxy 3':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "dbus-launch gsettings set org.gnome.system.proxy.http port 3128",
  }

exec { 'gconf proxy 1':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string --set /system/proxy/mode 'manual'",
  }
exec { 'gconf proxy 2':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type int    --set /system/http_proxy/port '3128'",
  }
exec { 'gconf proxy 3':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool   --set /system/http_proxy/use_same_proxy 'TRUE'",
  }
exec { 'gconf proxy 4':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool   --set /system/http_proxy/use_http_proxy 'TRUE'",
  }
exec { 'gconf proxy 5':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings set org.gnome.system.proxy.http port 3128",
  }
exec { 'gconf proxy 6':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings set org.gnome.system.proxy.https port 3128",
  }
exec { 'gconf proxy 7':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings set org.gnome.system.proxy.http host 'xxx.xxx.xxx.xxx'",
  }
exec { 'gconf proxy 8':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings get org.gnome.system.proxy.https host 'xxx.xxx.xxx.xxx'",
  }'",
  }
exec { 'dbus proxy 3':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "dbus-launch gsettings set org.gnome.system.proxy.http port 3128",
  }

exec { 'gconf proxy 1':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string --set /system/proxy/mode 'manual'",
  }
exec { 'gconf proxy 2':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type int    --set /system/http_proxy/port '3128'",
  }
exec { 'gconf proxy 3':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool   --set /system/http_proxy/use_same_proxy 'TRUE'",
  }
exec { 'gconf proxy 4':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool   --set /system/http_proxy/use_http_proxy 'TRUE'",
  }
exec { 'gconf proxy 5':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings set org.gnome.system.proxy.http port 3128",
  }
exec { 'gconf proxy 6':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings set org.gnome.system.proxy.https port 3128",
  }
exec { 'gconf proxy 7':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings set org.gnome.system.proxy.http host 'xxx.xxx.xxx.xxx'",
  }
exec { 'gconf proxy 8':
      path => ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"],
      command => "gsettings get org.gnome.system.proxy.https host 'xxx.xxx.xxx.xxx'",
  }

Felix Frank

unread,
Feb 9, 2014, 1:32:13 PM2/9/14
to puppet...@googlegroups.com
Hi,

in what way is puppet failing?

Generally, I'll have to remark that the manifest you shared facilitates
(at least) three anti-patterns.
1. You rely on a large number of exec resources to do your work. Where
so many commands need executing, you would be better off deploying a
script via file { } and running it through a single exec.
2. Your exec resources specify no conditions and run always. Each should
have either a creates, onlyif or unless parameter.
3. There is no order declared for your resources, e.g. using
before/require or the -> arrow syntax.

The latter points may be non-issues of the pertinent parts had merely
been redacted. Otherwise, point 3 may be a reason for your problems.

Regards,
Felix
Reply all
Reply to author
Forward
0 new messages