apt-cacher/server/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sat, 10 Sep 2022 14:52:44 -0500
changeset 192 febbf9c3394c
parent 187 0f3a64c60ec5
child 238 bdbc88cb5078
permissions -rw-r--r--
Made adguard blocking default on.

---

- name: install apt packages
  become: yes
  apt: name="apt-cacher-ng"
  notify: restart apt-cacher-ng

- name: configure apt-cacher dirs
  become: yes
  lineinfile:
    path: "/etc/apt-cacher-ng/acng.conf"
    regexp: "^{{item.key}}:"
    insertafter: "^# {{item.key}}:"
    line: "{{item.key}}: {{item.val}}"
  loop:
    - { key: "CacheDir", val: "{{apt_cacher_cache_dir}}" }
    - { key: "LogDir", val: "{{apt_cacher_log_dir}}" }
    - { key: "Port", val: "{{apt_cacher_port}}" }
  notify: restart apt-cacher-ng

- name: make cache and log dirs
  become: yes
  file:
    path: "{{item}}"
    state: "directory"
    owner: "apt-cacher-ng"
    group: "apt-cacher-ng"
  loop:
    - "{{apt_cacher_cache_dir}}"
    - "{{apt_cacher_log_dir}}"
  notify: restart apt-cacher-ng