@installdoc/ansible-gas-station
Version:
An Ansible playbook that provisions your network with software from GitHub Awesome lists, developed with disaster recovery in mind ⛽🔥🤤
57 lines (49 loc) • 1.65 kB
YAML
- name: Install AptCacherNG
apt:
name: apt-cacher-ng
state: present
update_cache: "{{ omit if skip_package_cache_update is defined else 'true' }}"
notify:
- clear apt cache
- apt update
- name: Enable AptCacherNG service
systemd:
name: apt-cacher-ng
enabled: true
state: started
- name: Configure PassThroughPattern
lineinfile:
dest: "{{ apt_cacher_config_path }}"
regexp: "(#PassThroughPattern: .* # this would allow|^PassThroughPattern: )"
line: "PassThroughPattern: {{ apt_cacher_passthrough_pattern }}"
notify: restart apt-cacher-ng
- name: Configure ExThreshold
lineinfile:
dest: "{{ apt_cacher_config_path }}"
regexp: "ExThreshold: "
line: "ExThreshold: {{ apt_cacher_exthreshold }}"
notify: restart apt-cacher-ng
- name: Make AptCacherNG use a Tor proxy
lineinfile:
dest: "{{ apt_cacher_config_path }}"
regexp: "# AptCacherNG Tor proxy"
line: "Proxy: http://127.0.0.1:8118 # AptCacherNG Tor proxy"
notify: restart apt-cacher-ng
when: apt_cacher_proxy_tor
- name: Configure admin account
lineinfile:
dest: "{{ apt_cacher_security_config_path }}"
regexp: "AdminAuth"
line: "AdminAuth: {{ apt_cacher_admin_username }}:{{ apt_cacher_admin_password }}"
notify: restart apt-cacher-ng
- name: Configure /etc/hosts.allow
lineinfile:
dest: /etc/hosts.allow
regexp: "# AptCacherNG"
line: "apt-cacher-ng : {{ apt_cacher_allowed_hosts }} # AptCacherNG"
- name: Configure /etc/hosts.deny
lineinfile:
dest: /etc/hosts.deny
regexp: "# AptCacherNG"
line: "apt-cacher-ng : {{ apt_cacher_denied_hosts }} # AptCacherNG"