2019-10-24 20:27:35 +02:00
|
|
|
- name: install apt-cacher-ng package
|
|
|
|
apt:
|
|
|
|
name: apt-cacher-ng
|
|
|
|
state: latest
|
|
|
|
|
|
|
|
- name: enable apt-cacher-ng for localhost
|
|
|
|
copy:
|
|
|
|
src: apt.conf
|
|
|
|
dest: /etc/apt/apt.conf
|
|
|
|
backup: yes
|
|
|
|
notify: "start apt-cacher-ng"
|
2019-11-25 18:26:21 +01:00
|
|
|
when: not run_in_installer|default(false)|bool ## do not enable apt-cacher during installation
|
|
|
|
|
|
|
|
|
|
|
|
- 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"
|
|
|
|
regexp: '^(d-i mirror/http/proxy string.*)$'
|
|
|
|
replace: 'd-i mirror/http/proxy string http://{{ ansible_hostname }}:3142/'
|
|
|
|
when: preseedcfg.stat.exists
|
2019-10-24 20:27:35 +02:00
|
|
|
|
2019-11-27 18:31:52 +01:00
|
|
|
- name: allow apt-cacher-ng service in firewalld
|
|
|
|
firewalld:
|
|
|
|
zone: internal
|
|
|
|
port: 3142/tcp
|
|
|
|
permanent: yes
|
2020-03-12 16:48:54 +01:00
|
|
|
immediate: yes
|
2019-11-27 18:31:52 +01:00
|
|
|
state: enabled
|
|
|
|
|
2019-10-24 20:27:35 +02:00
|
|
|
- meta: flush_handlers
|