mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-04-18 19:23:17 +02:00
39 lines
1.5 KiB
YAML
39 lines
1.5 KiB
YAML
---
|
|
|
|
- name: Add a profile script
|
|
template: src=proxy.sh.j2 dest=/etc/profile.d/proxy.sh mode=755
|
|
tags: proxy
|
|
|
|
- name: Add lines in environment file
|
|
lineinfile:
|
|
dest: /etc/environment
|
|
regexp: "^{{ item }}=.*"
|
|
line: "{{ item }}={{ (system_proxy is defined and system_proxy != '') | ternary(system_proxy,'') }}"
|
|
state: "{{ (system_proxy is defined and system_proxy != '') | ternary('present','absent') }}"
|
|
with_items: "{{ system_proxy_proto | map('regex_replace', '^(.*)$', '\\1_proxy') | list }} + {{ system_proxy_proto | map('regex_replace', '^(.*)$', '\\1_proxy') | map('upper') | list }}"
|
|
tags: proxy
|
|
|
|
- name: Set proxy exceptions
|
|
lineinfile:
|
|
dest: /etc/environment
|
|
regexp: "^{{ item }}=.*"
|
|
line: "{{ item }}={{ (system_proxy is defined and system_proxy != '' and system_proxy_no_proxy is defined and system_proxy_no_proxy | length > 0) | ternary(system_proxy_no_proxy | join(','),'') }}"
|
|
state: "{{ (system_proxy is defined and system_proxy != '' and system_proxy_no_proxy is defined and system_proxy_no_proxy | length > 0) | ternary('present','absent') }}"
|
|
with_items:
|
|
- no_proxy
|
|
- NO_PROXY
|
|
tags: proxy
|
|
|
|
- when: ansible_service_mgr == 'systemd'
|
|
block:
|
|
- name: Creates systemd.conf.d dir
|
|
file: path=/etc/systemd/system.conf.d state=directory
|
|
|
|
- name: Deploy a systemd snippet for default proxy
|
|
template: src=systemd.conf.j2 dest=/etc/systemd/system.conf.d/proxy.conf
|
|
notify: reload systemd
|
|
tags: proxy
|
|
|
|
- include: "{{ ansible_os_family }}.yml"
|
|
|