summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-05-23 00:13:20 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-05-23 00:13:20 +0200
commit8e168f685e82cbe129e7215d31450283c2eed44a (patch)
treedad0a945c3c72ffa327ef2429bf6ecba85a2375a
parentch-apt: base install (diff)
basic apt-cache-ng role
-rw-r--r--chaos-at-home/ch-apt.yml6
-rw-r--r--inventory/host_vars/ch-apt.yml13
-rw-r--r--roles/apt-cacher-ng/defaults/main.yml3
-rw-r--r--roles/apt-cacher-ng/tasks/main.yml26
4 files changed, 48 insertions, 0 deletions
diff --git a/chaos-at-home/ch-apt.yml b/chaos-at-home/ch-apt.yml
index 3c38bb64..b159a854 100644
--- a/chaos-at-home/ch-apt.yml
+++ b/chaos-at-home/ch-apt.yml
@@ -7,3 +7,9 @@
- role: core/sshd/base
- role: core/zsh
- role: core/ntp
+
+- name: Payload Setup
+ hosts: ch-apt
+ roles:
+ - role: storage/lvm/base
+ - role: apt-cacher-ng
diff --git a/inventory/host_vars/ch-apt.yml b/inventory/host_vars/ch-apt.yml
index c6260c54..2d4d5592 100644
--- a/inventory/host_vars/ch-apt.yml
+++ b/inventory/host_vars/ch-apt.yml
@@ -37,3 +37,16 @@ network:
gateway: "{{ network_zones.svc.prefix | ansible.utils.ipaddr(network_zones.svc.offsets['ch-gw-lan']) | ansible.utils.ipaddr('address') }}"
interfaces:
- *_network_primary_
+
+
+lvm_groups:
+ storage:
+ pvs:
+ - /dev/sdb
+
+apt_cacher_ng_storage:
+ type: lvm
+ vg: storage
+ lv: apt-cacher-ng
+ size: 15G
+ fs: ext4
diff --git a/roles/apt-cacher-ng/defaults/main.yml b/roles/apt-cacher-ng/defaults/main.yml
new file mode 100644
index 00000000..abdf06ee
--- /dev/null
+++ b/roles/apt-cacher-ng/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+# apt_cacher_ng_storage:
+# type: ...
diff --git a/roles/apt-cacher-ng/tasks/main.yml b/roles/apt-cacher-ng/tasks/main.yml
new file mode 100644
index 00000000..bfe05383
--- /dev/null
+++ b/roles/apt-cacher-ng/tasks/main.yml
@@ -0,0 +1,26 @@
+---
+- name: create apt-cacher-ng user
+ user:
+ name: apt-cacher-ng
+ home: /var/cache/apt-cacher-ng
+ shell: /usr/sbin/nologin
+ create_home: no
+ system: yes
+ state: present
+
+- name: prepare storage volume for /var/cache/apt-cacher-ng
+ when: apt_cacher_ng_storage is defined
+ vars:
+ apt_cacher_ng_storage_override:
+ dest: /var/cache/apt-cacher-ng
+ owner: apt-cacher-ng
+ group: apt-cacher-ng
+ mode: '02755'
+ storage_volume: "{{ apt_cacher_ng_storage | combine(apt_cacher_ng_storage_override) }}"
+ include_role:
+ name: "storage/{{ apt_cacher_ng_storage.type }}/volume"
+
+- name: install apt-cacher-ng
+ apt:
+ name: apt-cacher-ng
+ state: present