-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathproxy.sh
executable file
·56 lines (51 loc) · 2.11 KB
/
proxy.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Copy proxy to .env files for use in docker_compose files
# env_file:
# - Dockerfiles/ansible.env
ansible_file=Dockerfiles/ansible.env
zabbix_file=Dockerfiles/zabbix.env
grep -q NO_PROXY= $ansible_file && sed -i.bak '/NO_PROXY=.*/d' $ansible_file
grep -q NO_PROXY= $zabbix_file && sed -i.bak '/NO_PROXY=.*/d' $zabbix_file
grep -q no_proxy= $ansible_file && sed -i.bak '/no_proxy=.*/d' $ansible_file
grep -q no_proxy= $zabbix_file && sed -i.bak '/no_proxy=.*/d' $zabbix_file
if [ -v NO_PROXY ]
then
echo "NO_PROXY=$NO_PROXY" >> $ansible_file
echo "NO_PROXY=$NO_PROXY" >> $zabbix_file
echo "no_proxy=$NO_PROXY" >> $ansible_file
echo "no_proxy=$NO_PROXY" >> $zabbix_file
echo "NO_PROXY="$NO_PROXY
echo "no_proxy="$no_proxy
else
echo "NO_PROXY environment variable not found"
fi
grep -q HTTP_PROXY= $ansible_file && sed -i.bak '/HTTP_PROXY=.*/d' $ansible_file
grep -q HTTP_PROXY= $zabbix_file && sed -i.bak '/HTTP_PROXY=.*/d' $zabbix_file
grep -q http_proxy= $ansible_file && sed -i.bak '/http_proxy=.*/d' $ansible_file
grep -q http_proxy= $zabbix_file && sed -i.bak '/http_proxy=.*/d' $zabbix_file
if [ -v HTTP_PROXY ]
then
echo "HTTP_PROXY=$HTTP_PROXY" >> $ansible_file
echo "HTTP_PROXY=$HTTP_PROXY" >> $zabbix_file
echo "http_proxy=$HTTP_PROXY" >> $ansible_file
echo "http_proxy=$HTTP_PROXY" >> $zabbix_file
echo "HTTP_PROXY="$HTTP_PROXY
echo "http_proxy="$http_proxy
else
echo "HTTP_PROXY environment variable not found"
fi
grep -q HTTPS_PROXY= $ansible_file && sed -i.bak '/HTTPS_PROXY=.*/d' $ansible_file
grep -q HTTPS_PROXY= $zabbix_file && sed -i.bak '/HTTPS_PROXY=.*/d' $zabbix_file
grep -q https_proxy= $ansible_file && sed -i.bak '/https_proxy=.*/d' $ansible_file
grep -q https_proxy= $zabbix_file && sed -i.bak '/https_proxy=.*/d' $zabbix_file
if [ -v HTTPS_PROXY ]
then
echo "HTTPS_PROXY=$HTTPS_PROXY" >> $ansible_file
echo "HTTPS_PROXY=$HTTPS_PROXY" >> $zabbix_file
echo "https_proxy=$HTTPS_PROXY" >> $ansible_file
echo "https_proxy=$HTTPS_PROXY" >> $zabbix_file
echo "HTTPS_PROXY="$HTTPS_PROXY
echo "https_proxy="$https_proxy
else
echo "HTTPS_PROXY environment variable not found"
fi