2019-10-24 20:27:35 +02:00
|
|
|
- name: install apt-cacher-ng package
|
|
|
|
apt:
|
2022-06-26 11:58:49 +02:00
|
|
|
name:
|
|
|
|
- apt-cacher-ng
|
|
|
|
- auto-apt-proxy
|
2022-06-11 12:42:02 +02:00
|
|
|
state: latest # noqa package-latest
|
2019-10-24 20:27:35 +02:00
|
|
|
|
2019-11-25 18:26:21 +01:00
|
|
|
- name: check if preseeded installer is available
|
|
|
|
stat: path={{ tftp_root }}/d-i/{{ di_dist }}/preseed.cfg
|
|
|
|
register: preseedcfg
|
|
|
|
|
|
|
|
- name: enable apt-cacher-ng for install-clients
|
|
|
|
replace:
|
|
|
|
dest: "{{ tftp_root }}/d-i/{{ di_dist }}/preseed.cfg"
|
2020-03-17 20:30:23 +01:00
|
|
|
regexp: '^d-i mirror/http/proxy string$'
|
2019-11-25 18:26:21 +01:00
|
|
|
replace: 'd-i mirror/http/proxy string http://{{ ansible_hostname }}:3142/'
|
|
|
|
when: preseedcfg.stat.exists
|
2019-10-24 20:27:35 +02:00
|
|
|
|
2022-06-25 10:15:19 +02:00
|
|
|
- name: test if firewalld is available
|
|
|
|
stat: path=/usr/sbin/firewalld
|
|
|
|
register: firewalld
|
|
|
|
|
2019-11-27 18:31:52 +01:00
|
|
|
- name: allow apt-cacher-ng service in firewalld
|
|
|
|
firewalld:
|
|
|
|
zone: internal
|
|
|
|
port: 3142/tcp
|
2022-06-11 12:42:02 +02:00
|
|
|
permanent: true
|
|
|
|
immediate: true
|
2019-11-27 18:31:52 +01:00
|
|
|
state: enabled
|
2022-06-25 10:15:19 +02:00
|
|
|
when: not run_in_installer|default(false)|bool and firewalld.stat.exists
|
2020-03-17 08:52:06 +01:00
|
|
|
|
|
|
|
- name: allow apt-cacher-ng service in firewalld, offline
|
|
|
|
command: "firewall-offline-cmd --zone=internal --add-port=3142/tcp"
|
2022-06-25 10:15:19 +02:00
|
|
|
when: run_in_installer|default(false)|bool and firewalld.stat.exists
|
2020-03-17 08:52:06 +01:00
|
|
|
|
2022-06-11 12:42:02 +02:00
|
|
|
- name: flush handler to make apt-cacher available
|
|
|
|
meta: flush_handlers
|