terraform-k8s/roles/proxy/tasks/main.yml
2019-01-22 13:10:16 +01:00

69 lines
2.3 KiB
YAML

---
- name: set proxy for yum
lineinfile:
dest: /etc/yum.conf
regexp: "^proxy="
line: "proxy=http://[2001:470:6d:22c::1]:3128"
- name: ensure wgetrc exists
file:
path: /etc/wgetrc
state: touch
- name: set proxy for wget
lineinfile:
dest: /etc/wgetrc
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^http_proxy', line: 'http_proxy=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^https_proxy', line: 'https_proxy=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^ftp_proxy', line: 'ftp_proxy=http://[2001:470:6d:22c::1]:3128' }
- name: set proxy systemwide
lineinfile:
dest: /etc/environment
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^export\ http_proxy', line: 'export http_proxy=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^export\ https_proxy', line: 'export https_proxy=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^export\ ftp_proxy', line: 'export ftp_proxy=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^export\ no_proxy', line: 'export no_proxy=localhost,::1,' }
- name: ensure proxy env file exists
file:
path: /etc/profile.d/webproxy.sh
state: touch
mode: "u=rw,g=r,o=r"
- name: set proxy environment variables
lineinfile:
dest: /etc/profile.d/webproxy.sh
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^HTTP_PROXY', line: 'HTTP_PROXY=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^HTTPS_PROXY', line: 'HTTPS_PROXY=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^http_proxy', line: 'http_proxy=http://[2001:470:6d:22c::1]:3128' }
- { regexp: '^https_proxy', line: 'https_proxy=http://[2001:470:6d:22c::1]:3128' }
- name: ensure systemd conf folder exists
file:
path: /etc/systemd/system.conf.d
state: directory
- name: ensure systemd default env file exists
file:
path: /etc/systemd/system.conf.d/10-default-env.conf
state: touch
- name: set proxy for systemd
lineinfile:
dest: /etc/systemd/system.conf.d/10-default-env.conf
regexp: "^DefaultEnvironment=HTTP_PROXY"
line: "DefaultEnvironment=HTTP_PROXY=http://[2001:470:6d:22c::1]:3128"