Roles: add service-cpthook

This commit is contained in:
Julian Labus 2019-02-15 11:39:48 +01:00
parent bfe9509580
commit e29fd1c5d5
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A
7 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,16 @@
# Ansible role service-cpthook
Diese Ansible role installiert CptHook.
- schreibt cpthook.yml
- schreibt cpthook.service
- kompiliert und installiert CptHook
- aktiviert die systemd unit `cpthook.service`
# Benötigte Variablen
- Variable `gopath`
- Variable `cpthook_path` (Rollen-Variable)
- Variable `cpthook_config` (Rollen-Variable)
- Variable `cpthook_src` (Rollen-Variable)

View file

@ -0,0 +1,9 @@
---
- name: reload systemd
systemd:
daemon_reload: yes
- name: restart cpthook
systemd:
name: cpthook
state: restarted

View file

@ -0,0 +1,3 @@
---
dependencies:
- { role: golang }

View file

@ -0,0 +1,22 @@
---
- name: write cpthook config
template:
src: "cpthook.yml.j2"
dest: "{{ cpthook_config }}"
notify: restart cpthook
- name: create systemd unit for cpthook
template:
src: "cpthook.service.j2"
dest: "/etc/systemd/system/cpthook.service"
notify: reload systemd
- name: build cpthook binary
shell: 'GOPATH={{ gopath }} go get -u {{ cpthook_src }}'
notify: restart cpthook
- name: configure cpthook systemd unit
systemd:
name: "cpthook.service"
enabled: yes
state: started

View file

@ -0,0 +1,18 @@
[Unit]
Description=CptHook Webhook Gateway
Documentation=https://{{ cpthook_src }}
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=nobody
Group=nogroup
ExecStart={{ cpthook_path }}
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,18 @@
#
# {{ ansible_managed }}
#
http:
listen: "127.0.0.1:8084"
irc:
host: "irc.hackint.eu"
port: 6697
ssl:
enabled: true
nickname: "ffmwu-prom"
modules:
prometheus:
enabled: true
channel: "#ffmwu-feed"

View file

@ -0,0 +1,4 @@
---
cpthook_path: "{{ gopath }}/bin/CptHook"
cpthook_config: "/etc/cpthook.yml"
cpthook_src: "github.com/fleaz/CptHook"