apt-cacher/server/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 05 Sep 2022 17:58:32 -0500
changeset 188 4f2ad619134b
parent 187 0f3a64c60ec5
child 238 bdbc88cb5078
permissions -rw-r--r--
Added apt-cacher handler.

---

- 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