Make ninjabot role work
parent
f69c975ece
commit
efff9f75d3
|
@ -17,18 +17,18 @@
|
||||||
retries: 3
|
retries: 3
|
||||||
until: apt_result is succeeded
|
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:
|
template:
|
||||||
src: systemd/system/ninjabot.service.j2
|
src: systemd/system/ninjabot.service.j2
|
||||||
dest: /etc/systemd/system/ninjabot.service
|
dest: /etc/systemd/system/ninjabot.service
|
||||||
mode: 0644
|
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
|
- name: Load and activate NinjaBot service
|
||||||
systemd:
|
systemd:
|
||||||
name: ninjabot
|
name: ninjabot
|
||||||
|
@ -36,13 +36,6 @@
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
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
|
- name: Indicate NinjaBot in motd
|
||||||
template:
|
template:
|
||||||
src: update-motd.d/05-service.j2
|
src: update-motd.d/05-service.j2
|
||||||
|
|
|
@ -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
|
|
|
@ -6,9 +6,9 @@ After=network.target
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/var/local/ninjabot
|
WorkingDirectory=/var/local/ninjabot
|
||||||
User=ninjabot
|
User=nobody
|
||||||
Group=nogroup
|
Group=nogroup
|
||||||
ExecStart=/usr/bin/python3 /var/local/ninjabot/ninjabot.py
|
ExecStart=/usr/bin/python3 /var/local/ninjabot/main.py
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -11,12 +11,14 @@
|
||||||
template:
|
template:
|
||||||
src: prometheus/prometheus.yml.j2
|
src: prometheus/prometheus.yml.j2
|
||||||
dest: /etc/prometheus/prometheus.yml
|
dest: /etc/prometheus/prometheus.yml
|
||||||
|
mode: 0644
|
||||||
notify: Restart Prometheus
|
notify: Restart Prometheus
|
||||||
|
|
||||||
- name: Configure Prometheus alert rules
|
- name: Configure Prometheus alert rules
|
||||||
template:
|
template:
|
||||||
src: "prometheus/{{ item }}.j2"
|
src: "prometheus/{{ item }}.j2"
|
||||||
dest: "/etc/prometheus/{{ item }}"
|
dest: "/etc/prometheus/{{ item }}"
|
||||||
|
mode: 0644
|
||||||
notify: Restart Prometheus
|
notify: Restart Prometheus
|
||||||
loop:
|
loop:
|
||||||
- alert.rules.yml
|
- alert.rules.yml
|
||||||
|
@ -27,18 +29,21 @@
|
||||||
copy:
|
copy:
|
||||||
content: "{{ [{'targets': prometheus.node_targets}] | to_nice_json }}"
|
content: "{{ [{'targets': prometheus.node_targets}] | to_nice_json }}"
|
||||||
dest: /etc/prometheus/targets.json
|
dest: /etc/prometheus/targets.json
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
# We don't need to restart Prometheus when updating nodes
|
# We don't need to restart Prometheus when updating nodes
|
||||||
- name: Configure Prometheus UPS SNMP devices
|
- name: Configure Prometheus UPS SNMP devices
|
||||||
copy:
|
copy:
|
||||||
content: "{{ [{'targets': prometheus.ups_snmp_targets}] | to_nice_json }}"
|
content: "{{ [{'targets': prometheus.ups_snmp_targets}] | to_nice_json }}"
|
||||||
dest: /etc/prometheus/targets_ups_snmp.json
|
dest: /etc/prometheus/targets_ups_snmp.json
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
# We don't need to restart Prometheus when updating nodes
|
# We don't need to restart Prometheus when updating nodes
|
||||||
- name: Configure Prometheus Ubiquity Unifi SNMP devices
|
- name: Configure Prometheus Ubiquity Unifi SNMP devices
|
||||||
copy:
|
copy:
|
||||||
content: "{{ [{'targets': prometheus.unifi_snmp_targets}] | to_nice_json }}"
|
content: "{{ [{'targets': prometheus.unifi_snmp_targets}] | to_nice_json }}"
|
||||||
dest: /etc/prometheus/targets_unifi_snmp.json
|
dest: /etc/prometheus/targets_unifi_snmp.json
|
||||||
|
mode: 0644
|
||||||
when: prometheus.unifi_snmp_targets is defined
|
when: prometheus.unifi_snmp_targets is defined
|
||||||
|
|
||||||
# We don't need to restart Prometheus when updating nodes
|
# We don't need to restart Prometheus when updating nodes
|
||||||
|
@ -46,6 +51,7 @@
|
||||||
copy:
|
copy:
|
||||||
content: "{{ [{'targets': prometheus.apache_targets}] | to_nice_json }}"
|
content: "{{ [{'targets': prometheus.apache_targets}] | to_nice_json }}"
|
||||||
dest: /etc/prometheus/targets_apache.json
|
dest: /etc/prometheus/targets_apache.json
|
||||||
|
mode: 0644
|
||||||
when: prometheus.apache_targets is defined
|
when: prometheus.apache_targets is defined
|
||||||
|
|
||||||
# We don't need to restart Prometheus when updating nodes
|
# We don't need to restart Prometheus when updating nodes
|
||||||
|
@ -53,6 +59,7 @@
|
||||||
copy:
|
copy:
|
||||||
content: "{{ [{'targets': prometheus.blackbox_targets}] | to_nice_json }}"
|
content: "{{ [{'targets': prometheus.blackbox_targets}] | to_nice_json }}"
|
||||||
dest: /etc/prometheus/targets_blackbox.json
|
dest: /etc/prometheus/targets_blackbox.json
|
||||||
|
mode: 0644
|
||||||
when: prometheus.blackbox_targets is defined
|
when: prometheus.blackbox_targets is defined
|
||||||
|
|
||||||
- name: Activate prometheus service
|
- name: Activate prometheus service
|
||||||
|
|
Loading…
Reference in New Issue