mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-26 15:55:56 +02:00
Update to 2022-02-09 17:00
This commit is contained in:
17
roles/system_proxy/tasks/Debian.yml
Normal file
17
roles/system_proxy/tasks/Debian.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
|
||||
- name: Config proxy for apt
|
||||
copy:
|
||||
content: |
|
||||
Acquire::http::Proxy "{{ system_proxy }}";
|
||||
Acquire::https::Proxy "{{ system_proxy }}";
|
||||
dest: /etc/apt/apt.conf.d/10proxy
|
||||
when:
|
||||
- system_proxy is defined
|
||||
- system_proxy != ''
|
||||
tags: proxy
|
||||
|
||||
- name: Remove proxy from apt config
|
||||
file: path=/etc/apt/apt.conf.d/10proxy state=absent
|
||||
when: system_proxy is not defined or system_proxy == ''
|
||||
tags: proxy
|
20
roles/system_proxy/tasks/RedHat.yml
Normal file
20
roles/system_proxy/tasks/RedHat.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- name: Configure proxy for yum
|
||||
ini_file:
|
||||
path: /etc/yum.conf
|
||||
section: main
|
||||
option: proxy
|
||||
value: "{{ (system_proxy is defined and system_proxy != '') | ternary(system_proxy,'') }}"
|
||||
state: "{{ (system_proxy is defined and system_proxy != '') | ternary('present','absent') }}"
|
||||
tags: proxy
|
||||
|
||||
- name: Configure proxy for dnf
|
||||
ini_file:
|
||||
path: /etc/dnf/yum.conf
|
||||
section: main
|
||||
option: proxy
|
||||
value: "{{ (system_proxy is defined and system_proxy != '') | ternary(system_proxy,'') }}"
|
||||
state: "{{ (system_proxy is defined and system_proxy != '') | ternary('present','absent') }}"
|
||||
when: ansible_distribution_major_version is version('8', '>=')
|
||||
tags: proxy
|
@@ -10,13 +10,7 @@
|
||||
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:
|
||||
- http_proxy
|
||||
- HTTP_PROXY
|
||||
- https_proxy
|
||||
- HTTPS_PROXY
|
||||
- ftp_proxy
|
||||
- FTP_PROXY
|
||||
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
|
||||
@@ -30,55 +24,15 @@
|
||||
- NO_PROXY
|
||||
tags: proxy
|
||||
|
||||
- name: Creates systemd.conf.d dir
|
||||
file: path=/etc/systemd/system.conf.d state=directory
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
- 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
|
||||
|
||||
- name: Deploy a systemd snippet for default proxy
|
||||
template: src=systemd.conf.j2 dest=/etc/systemd/system.conf.d/proxy.conf
|
||||
notify: reload systemd
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
tags: proxy
|
||||
|
||||
- name: Configure proxy for yum
|
||||
ini_file:
|
||||
path: /etc/yum.conf
|
||||
section: main
|
||||
option: proxy
|
||||
value: "{{ (system_proxy is defined and system_proxy != '') | ternary(system_proxy,'') }}"
|
||||
state: "{{ (system_proxy is defined and system_proxy != '') | ternary('present','absent') }}"
|
||||
when: ansible_os_family == 'RedHat'
|
||||
tags: proxy
|
||||
|
||||
- name: Configure proxy for dnf
|
||||
ini_file:
|
||||
path: /etc/dnf/yum.conf
|
||||
section: main
|
||||
option: proxy
|
||||
value: "{{ (system_proxy is defined and system_proxy != '') | ternary(system_proxy,'') }}"
|
||||
state: "{{ (system_proxy is defined and system_proxy != '') | ternary('present','absent') }}"
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- ansible_distribution_major_version is version('8', '>=')
|
||||
tags: proxy
|
||||
|
||||
- name: Config proxy for apt
|
||||
copy:
|
||||
content: |
|
||||
Acquire::http::Proxy "{{ system_proxy }}";
|
||||
Acquire::https::Proxy "{{ system_proxy }}";
|
||||
dest: /etc/apt/apt.conf.d/10proxy
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- system_proxy is defined
|
||||
- system_proxy != ''
|
||||
tags: proxy
|
||||
|
||||
- name: Remove proxy from apt config
|
||||
file: path=/etc/apt/apt.conf.d/10proxy state=absent
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- system_proxy is not defined or system_proxy == ''
|
||||
tags: proxy
|
||||
- include: "{{ ansible_os_family }}.yml"
|
||||
|
||||
|
Reference in New Issue
Block a user