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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install apt packages
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt: name="apt-cacher-ng"
187
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
     6
  notify: restart apt-cacher-ng
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
- name: configure apt-cacher dirs
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    path: "/etc/apt-cacher-ng/acng.conf"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    regexp: "^{{item.key}}:"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
    insertafter: "^# {{item.key}}:"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
    line: "{{item.key}}: {{item.val}}"
144
267d58c0e186 Replaced with_items with loop.
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    15
  loop:
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
    - { key: "CacheDir", val: "{{apt_cacher_cache_dir}}" }
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
    - { key: "LogDir", val: "{{apt_cacher_log_dir}}" }
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    - { key: "Port", val: "{{apt_cacher_port}}" }
187
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    19
  notify: restart apt-cacher-ng
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    20
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    21
- name: make cache and log dirs
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    22
  become: yes
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    23
  file:
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    24
    path: "{{item}}"
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    25
    state: "directory"
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    26
    owner: "apt-cacher-ng"
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    27
    group: "apt-cacher-ng"
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    28
  loop:
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    29
    - "{{apt_cacher_cache_dir}}"
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    30
    - "{{apt_cacher_log_dir}}"
0f3a64c60ec5 Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
Luke Hoersten <luke@hoersten.org>
parents: 144
diff changeset
    31
  notify: restart apt-cacher-ng