Skip to content
Snippets Groups Projects
Commit 403e1e69 authored by me5na7qbjqbrp's avatar me5na7qbjqbrp
Browse files

Merge branch 'ninjaprom' into 'newinfra'

Make ninjabot role work

See merge request !107
parents f69c975e efff9f75
No related branches found
No related tags found
1 merge request!107Make ninjabot role work
......@@ -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
......
{{ 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
......@@ -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]
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment