ansible/roles/apt_cacher_ng/tasks/main.yml

55 lines
1.2 KiB
YAML

---
- name: Install apt-cacher-ng
apt:
name:
- apt-cacher-ng
state: latest
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Create config files
template:
src: "acng.conf.j2"
dest: "/etc/apt-cacher-ng/acng.conf"
owner: root
group: root
mode: '644'
notify: Restart apt-cacher-ng
- name: Create config files
template:
src: "security.conf.j2"
dest: "/etc/apt-cacher-ng/security.conf"
owner: root
group: apt-cacher-ng
mode: '640'
notify: Restart apt-cacher-ng
no_log: true
- name: Edit the clients allowed to use the proxy
lineinfile:
path: /etc/hosts.allow
regexp: '^apt-cacher-ng'
line: "apt-cacher-ng: 127.0.0.1 {{ apt_proxy_allowed_clients | join(' ') }}"
owner: root
group: root
mode: '644'
notify: Restart apt-cacher-ng
- name: Block everyone else
lineinfile:
path: /etc/hosts.deny
regexp: '^apt-cacher-ng'
line: "apt-cacher-ng: ALL"
owner: root
group: root
mode: '644'
notify: Restart apt-cacher-ng
- name: Enable apt-cacher-ng
systemd:
name: "apt-cacher-ng"
state: started
enabled: yes