Roles: add service-cpthook
This commit is contained in:
parent
bfe9509580
commit
e29fd1c5d5
7 changed files with 90 additions and 0 deletions
16
roles/service-cpthook/README.md
Normal file
16
roles/service-cpthook/README.md
Normal 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)
|
9
roles/service-cpthook/handlers/main.yml
Normal file
9
roles/service-cpthook/handlers/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
- name: reload systemd
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
|
||||
- name: restart cpthook
|
||||
systemd:
|
||||
name: cpthook
|
||||
state: restarted
|
3
roles/service-cpthook/meta/main.yml
Normal file
3
roles/service-cpthook/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- { role: golang }
|
22
roles/service-cpthook/tasks/main.yml
Normal file
22
roles/service-cpthook/tasks/main.yml
Normal 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
|
18
roles/service-cpthook/templates/cpthook.service.j2
Normal file
18
roles/service-cpthook/templates/cpthook.service.j2
Normal 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
|
18
roles/service-cpthook/templates/cpthook.yml.j2
Normal file
18
roles/service-cpthook/templates/cpthook.yml.j2
Normal 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"
|
4
roles/service-cpthook/vars/main.yml
Normal file
4
roles/service-cpthook/vars/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
cpthook_path: "{{ gopath }}/bin/CptHook"
|
||||
cpthook_config: "/etc/cpthook.yml"
|
||||
cpthook_src: "github.com/fleaz/CptHook"
|
Loading…
Reference in a new issue