New Ansible Role to build and install ntfy-alertmanager.

This commit is contained in:
Brian Lee 2023-05-25 15:53:25 -07:00
commit 72124b3fc1
6 changed files with 69 additions and 0 deletions

0
.gitignore vendored Normal file
View File

17
LICENSE Normal file
View File

@ -0,0 +1,17 @@
MIT No Attribution License
Copyright (c) 2023 Brian Lee
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# Ansible Role: ntfy-alertmanager
This Ansible Role installs [ntfy-alertmanager](https://git.xenrox.net/~xenrox/ntfy-alertmanager).
## Requirements
* [gantsign.golang](https://github.com/gantsign/ansible-role-golang)
## Role Variables
```yaml
ntfy_alertmanager_version: v0.2.0
```
## Example Playbook
```yaml
- hosts: all
roles:
- role: bleetube.ntfy-alertmanager
```

2
defaults/main.yml Normal file
View File

@ -0,0 +1,2 @@
---
ntfy_alertmanager_version: v0.2.0

3
meta/main.yml Normal file
View File

@ -0,0 +1,3 @@
---
dependencies:
- gantsign.golang

26
tasks/main.yml Normal file
View File

@ -0,0 +1,26 @@
---
- 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/
become: true