docker behind proxy to be configured in base

This commit is contained in:
Z. Cliffe Schreuders
2019-12-06 17:02:44 +00:00
parent 3667e849ee
commit e3660af2f8
2 changed files with 40 additions and 26 deletions

View File

@@ -9,29 +9,44 @@ include 'docker'
# proxy => "http://172.22.0.51:3128",
#}
# remove proxy config (it's in the template, and this overrides)
# file_line { 'remove_docker_proxy1':
# ensure => absent,
# path => '/etc/default/docker',
# line => 'HTTP_PROXY=""',
# } ->
# file_line { 'remove_docker_proxy2':
# ensure => absent,
# path => '/etc/default/docker',
# line => 'http_proxy=""',
# } ->
# file_line { 'remove_docker_proxy3':
# ensure => absent,
# path => '/etc/default/docker',
# line => 'https_proxy=""',
# } ->
# file_line { 'remove_docker_proxy4':
# ensure => absent,
# path => '/etc/default/docker',
# line => 'HTTPS_PROXY=""',
# } ->
# file_line { 'remove_docker_proxy_settings':
# ensure => absent,
# path => '/etc/default/docker',
# match => '^HTTP*_PROXY=*',
# match_for_absence => true,
# multiple => true,
# notify => Service['docker'], # reload docker once changed
# }
#
# # remove proxy config (it's in the template, and this overrides)
# exec { 'docker_remove_config_and_restart':
# command => "mv /etc/default/docker /etc/default/docker.mv; systemctl daemon-reload; systemctl restart docker",
# provider => shell,
# }
# download (pull) a set of images
$images.each |$image| {
docker::image { "$image": }
}
# remove proxy config (it's in the template, and this overrides)
file_line { 'remove_docker_proxy1':
ensure => absent,
path => '/etc/default/docker',
line => 'HTTP_PROXY=""',
}
file_line { 'remove_docker_proxy2':
ensure => absent,
path => '/etc/default/docker',
line => 'http_proxy=""',
}
file_line { 'remove_docker_proxy3':
ensure => absent,
path => '/etc/default/docker',
line => 'https_proxy=""',
}
file_line { 'remove_docker_proxy4':
ensure => absent,
path => '/etc/default/docker',
line => 'HTTPS_PROXY=""',
}

View File

@@ -29,10 +29,9 @@ OPTIONS="<% if @root_dir %><%= @root_dir_flag %> <%= @root_dir %><% end -%>
<% if @labels %><% @labels_array.each do |label| %> --label <%= label %><% end %><% end -%>
<% if @extra_parameters %><% @extra_parameters_array.each do |param| %> <%= param %><% end %><% end -%>"
<%# SecGen edit %>
<% if @proxy and @proxy != ''%>http_proxy='<%= @proxy %>'
https_proxy='<%= @proxy %>'<% end %>
<% if @no_proxy %>no_proxy='<%= @no_proxy %>'<% end %>
<%# SecGen %>
# SG edit -- removed proxy settings
# This is also a handy place to tweak where Docker's temporary files go.
<% if @tmp_dir_config %>TMPDIR="<%= @tmp_dir %>"<% else %># TMPDIR="<%= @tmp_dir %>"<% end %>
<% if @shell_values %><% @shell_values_array.each do |param| %> <%= param %><% end %><% end -%>