Merge branch 'ninjaprom' into 'newinfra'

Make ninjabot role work

See merge request nounous/ansible!107
certbot_on_virtu
erdnaxe 2020-11-28 18:44:02 +01:00
commit 403e1e69c2
4 changed files with 16 additions and 31 deletions

View File

@ -17,18 +17,18 @@
retries: 3
until: apt_result is succeeded
- name: Deploy NinjaBot main systemd unit
- name: Clone NinjaBot code
git:
repo: https://gitlab.adm.crans.org/nounous/NinjaBot.git
dest: /var/local/ninjabot
version: master
- name: Deploy NinjaBot systemd unit
template:
src: systemd/system/ninjabot.service.j2
dest: /etc/systemd/system/ninjabot.service
mode: 0644
- name: Deploy NinjaBot webhook systemd unit
template:
src: systemd/system/ninjabot-webhook.service.j2
dest: /etc/systemd/system/ninjabot-webhook.service
mode: 0644
- name: Load and activate NinjaBot service
systemd:
name: ninjabot
@ -36,13 +36,6 @@
enabled: true
state: started
- name: Load and activate NinjaBot webook service
systemd:
name: ninjabot-webhook
daemon_reload: true
enabled: true
state: started
- name: Indicate NinjaBot in motd
template:
src: update-motd.d/05-service.j2

View File

@ -1,15 +0,0 @@
{{ ansible_header | comment }}
[Unit]
Description=NinjaBot WebHook server
After=network.target ninjabot.service
[Service]
Type=simple
WorkingDirectory=/var/local/ninjabot
User=ninjabot
Group=nogroup
ExecStart=/usr/bin/python3 /var/local/ninjabot/main.py
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -6,9 +6,9 @@ After=network.target
[Service]
Type=simple
WorkingDirectory=/var/local/ninjabot
User=ninjabot
User=nobody
Group=nogroup
ExecStart=/usr/bin/python3 /var/local/ninjabot/ninjabot.py
ExecStart=/usr/bin/python3 /var/local/ninjabot/main.py
Restart=always
[Install]

View File

@ -11,12 +11,14 @@
template:
src: prometheus/prometheus.yml.j2
dest: /etc/prometheus/prometheus.yml
mode: 0644
notify: Restart Prometheus
- name: Configure Prometheus alert rules
template:
src: "prometheus/{{ item }}.j2"
dest: "/etc/prometheus/{{ item }}"
mode: 0644
notify: Restart Prometheus
loop:
- alert.rules.yml
@ -27,18 +29,21 @@
copy:
content: "{{ [{'targets': prometheus.node_targets}] | to_nice_json }}"
dest: /etc/prometheus/targets.json
mode: 0644
# We don't need to restart Prometheus when updating nodes
- name: Configure Prometheus UPS SNMP devices
copy:
content: "{{ [{'targets': prometheus.ups_snmp_targets}] | to_nice_json }}"
dest: /etc/prometheus/targets_ups_snmp.json
mode: 0644
# We don't need to restart Prometheus when updating nodes
- name: Configure Prometheus Ubiquity Unifi SNMP devices
copy:
content: "{{ [{'targets': prometheus.unifi_snmp_targets}] | to_nice_json }}"
dest: /etc/prometheus/targets_unifi_snmp.json
mode: 0644
when: prometheus.unifi_snmp_targets is defined
# We don't need to restart Prometheus when updating nodes
@ -46,6 +51,7 @@
copy:
content: "{{ [{'targets': prometheus.apache_targets}] | to_nice_json }}"
dest: /etc/prometheus/targets_apache.json
mode: 0644
when: prometheus.apache_targets is defined
# We don't need to restart Prometheus when updating nodes
@ -53,6 +59,7 @@
copy:
content: "{{ [{'targets': prometheus.blackbox_targets}] | to_nice_json }}"
dest: /etc/prometheus/targets_blackbox.json
mode: 0644
when: prometheus.blackbox_targets is defined
- name: Activate prometheus service