2023-05-25 22:53:25 +00:00
|
|
|
---
|
|
|
|
- name: Clone git repository
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: https://git.xenrox.net/~xenrox/ntfy-alertmanager
|
|
|
|
dest: "{{ ansible_env.HOME }}/src/ntfy-alertmanager"
|
|
|
|
version: "{{ ntfy_alertmanager_version }}"
|
2023-08-11 19:26:02 +00:00
|
|
|
force: true
|
2023-05-25 22:53:25 +00:00
|
|
|
register: git_repository
|
|
|
|
|
|
|
|
- name: Create the required version.txt file for building ntfy-alertmanager
|
|
|
|
ansible.builtin.shell:
|
|
|
|
chdir: "{{ ansible_env.HOME }}/src/ntfy-alertmanager"
|
|
|
|
cmd: git describe --long > version.txt
|
|
|
|
when: git_repository.changed
|
|
|
|
|
|
|
|
- name: Build ntfy-alertmanager
|
|
|
|
ansible.builtin.command:
|
|
|
|
chdir: "{{ ansible_env.HOME }}/src/ntfy-alertmanager"
|
|
|
|
cmd: "{{ ansible_local.golang.general.home }}/bin/go build ."
|
|
|
|
when: git_repository.changed
|
|
|
|
|
|
|
|
- name: Install ntfy-alertmanager binary
|
|
|
|
ansible.builtin.copy:
|
|
|
|
remote_src: true
|
|
|
|
src: "{{ ansible_env.HOME }}/src/ntfy-alertmanager/ntfy-alertmanager"
|
|
|
|
dest: /usr/local/bin/
|
2023-05-29 16:34:09 +00:00
|
|
|
mode: 0755
|
|
|
|
become: true
|
2023-08-11 19:26:02 +00:00
|
|
|
notify: restart ntfy-alertmanager
|
2023-05-29 16:34:09 +00:00
|
|
|
|
|
|
|
- name: Ensure configuration directory for ntfy-alertmanager
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/ntfy-alertmanager
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Configure ntfy-alertmanager
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: config.j2
|
|
|
|
dest: /etc/ntfy-alertmanager/config
|
|
|
|
become: true
|
2023-08-11 19:26:02 +00:00
|
|
|
notify: restart ntfy-alertmanager
|
2023-05-29 16:34:09 +00:00
|
|
|
|
|
|
|
- name: Copy systemd service file for ntfy-alertmanager
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: ntfy-alertmanager.service
|
|
|
|
dest: /etc/systemd/system/ntfy-alertmanager.service
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Ensure ntfy-alertmanager service is enabled
|
|
|
|
ansible.builtin.service:
|
|
|
|
name: ntfy-alertmanager
|
|
|
|
enabled: true
|
|
|
|
state: started
|
2023-05-25 22:53:25 +00:00
|
|
|
become: true
|