-
Notifications
You must be signed in to change notification settings - Fork 2
/
client_use_proxy.sls
36 lines (31 loc) · 1.09 KB
/
client_use_proxy.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{% if salt['pillar.get']('http_proxy', '') != '' %}
{% from "http_proxy/defaults.jinja" import default_no_proxy %}
{% if salt['grains.get']('os_family') == "Debian" %}
/etc/apt/apt.conf.d/02proxy:
file.managed:
- contents: |
Acquire::http { Proxy "{{ salt['pillar.get']('http_proxy') }}"; };
{%- if salt['pillar.get']('https_proxy', '') != '' %}
Acquire::https { Proxy "{{ salt['pillar.get']('https_proxy') }}"; };
{%- endif %}
- order: 5
{% endif %}
/etc/profile.d/proxy.sh:
file.managed:
- makedirs: True
- contents: |
http_proxy="{{ salt['pillar.get']('http_proxy') }}"
https_proxy="{{ salt['pillar.get']('https_proxy') }}"
no_proxy="{{ salt['pillar.get']('no_proxy', default_no_proxy) }}"
export http_proxy
export https_proxy
export no_proxy
- order: 5
/etc/sudoers.d/proxy:
file.managed:
- makedirs: True
- mode: "0440"
- contents: |
Defaults env_keep += "HTTP_PROXY HTTPS_PROXY FTP_PROXY NO_PROXY"
Defaults env_keep += "http_proxy https_proxy ftp_proxy no_proxy"
{% endif %}