apt-cacher/server/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 07 Oct 2024 15:25:37 -0500
changeset 238 bdbc88cb5078
parent 187 0f3a64c60ec5
permissions -rw-r--r--
Lots of updates and fixes for Ubuntu 24.04 Noble.

---

- 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}}" }
    - { key: "DlMaxRetries", val: "{{apt_cacher_max_dl_retries}}" }
    - { key: "DontCacheResolved", val: ".*InRelease" }

  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