From d2f029f8f09167b0aca0d86bfc32f8a387ce5aca Mon Sep 17 00:00:00 2001 From: Julian Rother Date: Sun, 27 Jul 2025 16:29:58 +0200 Subject: [PATCH] Initial commit --- defaults/main.yml | 2 ++ handlers/main.yml | 4 ++++ tasks/main.yml | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 tasks/main.yml diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..2199803 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +unpoller: + config: {} diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..b0c815a --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart unpoller + service: + name: loki + state: restarted diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..5b3c97c --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,36 @@ +- name: Download unpoller repo key + ansible.builtin.get_url: + url: https://packagecloud.io/golift/pkgs/gpgkey + checksum: sha256:7c4beacdf843dff04cd4317cfd9fc93edb725fec741d68146dc54a4300afafee + dest: /etc/apt/keyrings/golift_pkgs-archive-keyring.asc + +- name: Setup unpoller repo + ansible.builtin.apt_repository: + repo: deb [signed-by=/etc/apt/keyrings/golift_pkgs-archive-keyring.asc] https://packagecloud.io/golift/pkgs/ubuntu focal main + +- name: Install unpoller + ansible.builtin.apt: + pkg: unpoller + +- name: Write unpoller daemon config + notify: restart unpoller + ansible.builtin.copy: + owner: root + group: root + mode: 0644 + dest: /etc/default/unpoller + content: 'DAEMON_OPTS="-c /etc/unpoller/up.yaml"' + +- name: Write unpoller config + notify: restart unpoller + ansible.builtin.copy: + owner: unpoller + group: unpoller + mode: 0640 + dest: /etc/unpoller/up.yaml + content: "{{ unpoller.config|to_nice_yaml(indent=2) }}" + +- name: Delete default unpoller config + ansible.builtin.file: + path: /etc/unpoller/up.conf + state: absent