53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
---
|
|
- 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 }}"
|
|
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/
|
|
mode: 0755
|
|
become: true
|
|
|
|
- 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
|
|
|
|
- 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
|
|
become: true |