From 40d3c2227642e3223f8a4a3ad538d64dfcafcc4d Mon Sep 17 00:00:00 2001 From: pz2891 Date: Thu, 21 Jan 2021 21:26:40 +0100 Subject: [PATCH 1/8] Setup config snmp for Prometheus, to monitore Aurore's PDU --- monitoring.yml | 3 + roles/baseconfig/tasks/main.yml.save | 89 +++++++++++++++++++ roles/prometheus/tasks/main.yml | 7 ++ roles/prometheus/tasks/main.yml.save | 76 ++++++++++++++++ .../templates/prometheus/prometheus.yml.j2 | 16 ++++ .../templates/prometheus/snmp.yml.j2 | 72 +++++++++++++++ 6 files changed, 263 insertions(+) create mode 100644 roles/baseconfig/tasks/main.yml.save create mode 100644 roles/prometheus/tasks/main.yml.save diff --git a/monitoring.yml b/monitoring.yml index 714baa6..a64c5b5 100755 --- a/monitoring.yml +++ b/monitoring.yml @@ -34,6 +34,9 @@ snmp_unifi_password: "{{ vault_snmp_unifi_password }}" # Prometheus targets.json + prometheus_ups_snmp_targets: + - ups-ec-1.ups.auro.re + prometheus_targets: - targets: | {{ groups['edc_pve'] + groups['edc_vm'] | list | sort }} diff --git a/roles/baseconfig/tasks/main.yml.save b/roles/baseconfig/tasks/main.yml.save new file mode 100644 index 0000000..d73cf07 --- /dev/null +++ b/roles/baseconfig/tasks/main.yml.save @@ -0,0 +1,89 @@ +--- +# Should contain only small tools that everyone can't live without +- name: Install basic tools + when: ansible_os_family == "Debian" + apt: + name: + - sudo + - molly-guard # prevent reboot + - ntp # network time sync + - apt # better than apt-get + - nano # for vulcain + - vim # better than nano + - emacs-nox # for maman + - htop # better than top + - zsh # to be able to ssh @erdnaxe + - fish # to motivate @edpibu + - oidentd # postgresql identification + - aptitude # nice to have for Ansible + - acl # advanced ACL + - iotop # monitor i/o + - tree # create a graphical tree of files + - bash-completion # because bash + - git # code versioning + - less # i like cats + - screen # Vulcain asked for this + - lsb-release + update_cache: true + register: apt_result + retries: 3 + until: apt_result is succeeded + +# Pimp my server +- name: Customize motd + copy: + src: "update-motd.d/{{ item }}" + dest: "/etc/update-motd.d/{{ item }}" + mode: 0755 + loop: + - 00-logo + - 10-uname + +- name: Remove Debian warranty motd + file: + path: /etc/motd + state: absent + +# Configure APT mirrors on Debian Stretch +- name: Configure APT mirrors + when: + - ansible_distribution == 'Debian' + - ansible_distribution_release == 'stretch' + template: + src: apt/sources.list.j2 + dest: /etc/apt/sources.list + mode: 0644 + +# Patriotisme +- name: Ensure French UTF-8 locale exists + locale_gen: + name: fr_FR.UTF-8 + state: present + +# Fix LC_CTYPE="C" +- name: Select default locale + debconf: + name: locales + question: locales/default_environment_locale + value: fr_FR.UTF-8 + vtype: select + notify: Reconfigure locales + +# APT-List Changes : send email with changelog +- include_tasks: apt-listchanges.yml + +# User skeleton +- name: Configure user skeleton + copy: + src: "skel/dot_{{ item }}" + dest: "/etc/skel/.{{ item }}" + mode: 0644 + loop: + - zshrc + - zshrc.local + +- name: Configure resolvconf + template: + src: resolv.conf + dest: /etc/resolv.conf + mode: 0644 diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 211aee3..0b5ad0e 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -56,6 +56,13 @@ dest: /etc/prometheus/targets_unifi_snmp.json mode: 0644 +- name: Configure Prometheus UPS SNMP devices + copy: + content: "{{ [{'targets': prometheus_ups_snmp_targets }] | to_nice_json }}\n" + dest: /etc/prometheus/targets_ups_snmp.json + mode: 0644 + + - name: Activate prometheus service systemd: name: prometheus diff --git a/roles/prometheus/tasks/main.yml.save b/roles/prometheus/tasks/main.yml.save new file mode 100644 index 0000000..cca66e5 --- /dev/null +++ b/roles/prometheus/tasks/main.yml.save @@ -0,0 +1,76 @@ +--- +- name: Install Prometheus + apt: + update_cache: true + name: + - prometheus + - prometheus-snmp-exporter + register: apt_result + retries: 3 + until: apt_result is succeeded + +- name: Configure Prometheus + 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 + - django.rules.yml + +- name: Make Prometheus snmp-exporter listen on localhost only + lineinfile: + path: /etc/default/prometheus-snmp-exporter + regexp: '^ARGS=' + line: "ARGS=\"--web.listen-address=127.0.0.1:9116\"" + notify: Restart prometheus-snmp-exporter + +# This file store SNMP OIDs +- name: Configure Prometheus snmp-exporter + template: + src: "prometheus/snmp.yml.j2" + dest: "/etc/prometheus/snmp.yml" + mode: 0600 + owner: prometheus + notify: Restart prometheus-snmp-exporter + +# We don't need to restart Prometheus when updating nodes +- name: Configure Prometheus nodes + copy: + content: "{{ prometheus_targets | to_nice_json }}" + dest: /etc/prometheus/targets.json + mode: 0644 + +# We don't need to restart Prometheus when updating nodes +- name: Configure Prometheus Ubiquity Unifi SNMP devices + copy: + content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}" + dest: /etc/prometheus/targets_unifi_snmp.json + mode: 0644 + +- name: Configure Prometheus UPS SNMP devices + copy: + content: "{{ [{'target | to_nice_json }}" + dest: /etc/prometheus/targets_ups_snmp.json + mode: 0644 + + +- name: Activate prometheus service + systemd: + name: prometheus + enabled: true + state: started + +- name: Indicate role in motd + template: + src: update-motd.d/05-service.j2 + dest: /etc/update-motd.d/05-prometheus + mode: 0755 diff --git a/roles/prometheus/templates/prometheus/prometheus.yml.j2 b/roles/prometheus/templates/prometheus/prometheus.yml.j2 index 31df6bd..e35a0cf 100644 --- a/roles/prometheus/templates/prometheus/prometheus.yml.j2 +++ b/roles/prometheus/templates/prometheus/prometheus.yml.j2 @@ -65,3 +65,19 @@ scrape_configs: scheme: https static_configs: - targets: [] + + - job_name: ups_snmp + file_sd_configs: + - files: + - '/etc/prometheus/targets_ups_snmp.json' + metrics_path: /snmp + params: + module: [eatonups] + relabel_configs: + - source_labels: [__address__] + target_label: __param_target + - source_labels: [__param_target] + target_label: instance + - target_label: __address__ + replacement: 127.0.0.1:9116 + diff --git a/roles/prometheus/templates/prometheus/snmp.yml.j2 b/roles/prometheus/templates/prometheus/snmp.yml.j2 index 84dcb65..5968095 100644 --- a/roles/prometheus/templates/prometheus/snmp.yml.j2 +++ b/roles/prometheus/templates/prometheus/snmp.yml.j2 @@ -6,6 +6,78 @@ # - Optimiser les règles pour les bornes Unifi, # on pourrait indexer avec les SSID +eatonups: + walk: + - 1.3.6.1.2.1.33.1.2 + - 1.3.6.1.2.1.33.1.3 + - 1.3.6.1.2.1.33.1.4 + - 1.3.6.1.4.1.534.1.6 + get: + - 1.3.6.1.2.1.1.3.0 + metrics: + - name: sysUpTime + oid: 1.3.6.1.2.1.1.3 + type: gauge + help: The time (in hundredths of a second) since the network management portion + of the system was last re-initialized. - 1.3.6.1.2.1.1.3 + - name: upsBatteryStatus + oid: 1.3.6.1.2.1.33.1.2.1 + type: gauge + help: The indication of the capacity remaining in the UPS system's batteries - + 1.3.6.1.2.1.33.1.2.1 + - name: upsEstimatedMinutesRemaining + oid: 1.3.6.1.2.1.33.1.2.3 + type: gauge + help: An estimate of the time to battery charge depletion under the present load + conditions if the utility power is off and remains off, or if it were to be + lost and remain off. - 1.3.6.1.2.1.33.1.2.3 + - name: upsInputVoltage + oid: 1.3.6.1.2.1.33.1.3.3.1.3 + type: gauge + help: The magnitude of the present input voltage. - 1.3.6.1.2.1.33.1.3.3.1.3 + indexes: + - labelname: upsInputLineIndex + type: gauge + - name: upsOutputSource + oid: 1.3.6.1.2.1.33.1.4.1 + type: gauge + help: The present source of output power - 1.3.6.1.2.1.33.1.4.1 + - name: upsOutputVoltage + oid: 1.3.6.1.2.1.33.1.4.4.1.2 + type: gauge + help: The present output voltage. - 1.3.6.1.2.1.33.1.4.4.1.2 + indexes: + - labelname: upsOutputLineIndex + type: gauge + - name: upsOutputPower + oid: 1.3.6.1.2.1.33.1.4.4.1.4 + type: gauge + help: The present output true power. - 1.3.6.1.2.1.33.1.4.4.1.4 + indexes: + - labelname: upsOutputLineIndex + type: gauge + - name: upsOutputPercentLoad + oid: 1.3.6.1.2.1.33.1.4.4.1.5 + type: gauge + help: The percentage of the UPS power capacity presently being used on this output + line, i.e., the greater of the percent load of true power capacity and the percent + load of VA. - 1.3.6.1.2.1.33.1.4.4.1.5 + indexes: + - labelname: upsOutputLineIndex + type: gauge + - name: xupsEnvRemoteTemp + oid: 1.3.6.1.4.1.534.1.6.5 + type: gauge + help: The reading of an EMP's temperature sensor. - 1.3.6.1.4.1.534.1.6.5 + - name: xupsEnvRemoteHumidity + oid: 1.3.6.1.4.1.534.1.6.6 + type: gauge + help: The reading of an EMP's humidity sensor. - 1.3.6.1.4.1.534.1.6.6 + version: 1 + auth: + community: public + + procurve_switch: walk: - 1.3.6.1.2.1.31.1.1.1.10 -- 2.45.2 From c7a3495ae52cef3689e8d708bc832750120aadd2 Mon Sep 17 00:00:00 2001 From: pz2891 Date: Fri, 22 Jan 2021 12:16:36 +0100 Subject: [PATCH 2/8] Alert rules for UPS --- .../templates/prometheus/alert.rules.yml.j2 | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/roles/prometheus/templates/prometheus/alert.rules.yml.j2 b/roles/prometheus/templates/prometheus/alert.rules.yml.j2 index 2a10358..db99ab7 100644 --- a/roles/prometheus/templates/prometheus/alert.rules.yml.j2 +++ b/roles/prometheus/templates/prometheus/alert.rules.yml.j2 @@ -59,4 +59,71 @@ groups: severity: warning annotations: summary: "{{ $labels.name }} a échoué sur {{ $labels.instance }}" + + # Check UPS + - alert: UpsOutputSourceChanged + expr: upsOutputSource != 3 + for: 5m + labels: + severity: warning + annotations: + summary: "La source d'alimentation de {{ $labels.instance }} a changé !" + + - alert: UpsBatteryStatusWarning + expr: upsBatteryStatus == 3 + for: 5m + labels: + severity: warning + annotations: + summary: "L'état de la batterie de {{ $labels.instance }} est faible !" + + - alert: UpsBatteryStatusCritical + expr: upsBatteryStatus == 4 + for: 5m + labels: + severity: warning + annotations: + summary: "L'état de la batterie de {{ $labels.instance }} est affaibli !" + + - alert: UpsHighLoad + expr: upsOutputPercentLoad > 70 + for: 5m + labels: + severity: critical + annotations: + summary: "La charge de {{ $labels.instance }} est de {{ $value }}% !" + + - alert: UpsWrongInputVoltage + expr: (upsInputVoltage < 210) or (upsInputVoltage > 250) + for: 5m + labels: + severity: warning + annotations: + summary: "La tension d'entrée de {{ $labels.instance }} est de {{ $value }}V." + + - alert: UpsWrongOutputVoltage + expr: (upsOutputVoltage < 225) or (upsOutputVoltage > 235) + for: 5m + labels: + severity: warning + annotations: + summary: "La tension de sortie de {{ $labels.instance }} est de {{ $value }}V." + + - alert: UpsTimeRemainingWarning + expr: upsEstimatedMinutesRemaining < 15 + for: 5m + labels: + severity: warning + annotations: + summary: "L'autonomie restante sur {{ $labels.instance }} est de {{ $value }} min." + + - alert: UpsTimeRemainingCritical + expr: upsEstimatedMinutesRemaining < 5 + for: 5m + labels: + severity: critical + annotations: + summary: "L'autonomie restante sur {{ $labels.instance }} est de {{ $value }} min." + + {% endraw %} -- 2.45.2 From 705fe953ae5bdb534982001cf130f89fba5abdb1 Mon Sep 17 00:00:00 2001 From: pz2891 Date: Fri, 22 Jan 2021 18:20:13 +0100 Subject: [PATCH 3/8] Monitoring of Pacaterie's UPS --- monitoring.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitoring.yml b/monitoring.yml index a64c5b5..9bcc370 100755 --- a/monitoring.yml +++ b/monitoring.yml @@ -14,7 +14,7 @@ roles: - prometheus -- hosts: prometheus-pacaterie.adm.auro.re,prometheus-pacaterie-fo.adm.auro.re +- hosts: prometheus-pacaterie.adm.auro.re vars: prometheus_alertmanager: docker-ovh.adm.auro.re:9093 snmp_unifi_password: "{{ vault_snmp_unifi_password }}" @@ -25,8 +25,10 @@ {{ groups['pacaterie_pve'] + groups['pacaterie_vm'] | list | sort }} prometheus_unifi_snmp_targets: - targets: "{{ groups['pacaterie_unifi'] | list | sort }}" + prometheus_ups_snmp_targets: + - ups-pn-1.ups.auro.re roles: - - prometheus + - prometheus - hosts: prometheus-edc.adm.auro.re vars: -- 2.45.2 From bac377f6348691b31783199dbc282f8969963f0f Mon Sep 17 00:00:00 2001 From: pz2891 Date: Sat, 23 Jan 2021 19:01:27 +0100 Subject: [PATCH 4/8] Update alert rules of UPS --- hosts | 9 ++- monitoring.yml | 18 +++++ roles/prometheus/tasks/main.yml | 2 +- roles/prometheus/tasks/main.yml.save | 76 ------------------- .../templates/prometheus/alert.rules.yml.j2 | 2 +- test.sh | 5 -- 6 files changed, 26 insertions(+), 86 deletions(-) delete mode 100644 roles/prometheus/tasks/main.yml.save delete mode 100755 test.sh diff --git a/hosts b/hosts index a06cac8..6639a21 100644 --- a/hosts +++ b/hosts @@ -345,6 +345,7 @@ dns-rives-backup.adm.auro.re radius-rives-backup.adm.auro.re routeur-rives-backup.adm.auro.re ldap-replica-rives.adm.auro.re +prometheus-rives.adm.auro.re [rives_unifi] r3-4-4.borne.auro.re @@ -396,29 +397,31 @@ ovh_vm [fleming:children] fleming_pve fleming_vm -#fleming_unifi +fleming_unifi # everything at pacaterie [pacaterie:children] pacaterie_pve pacaterie_vm -#pacaterie_unifi +pacaterie_unifi # everything at edc [edc:children] edc_pve edc_vm +edc_unifi # everything at georgesand [gs:children] gs_pve gs_vm +gs_unifi # everything at Les Rives [rives:children] rives_pve rives_vm - +rives_unifi ############################################################################### # Groups by type diff --git a/monitoring.yml b/monitoring.yml index 9bcc370..fc59738 100755 --- a/monitoring.yml +++ b/monitoring.yml @@ -61,6 +61,24 @@ roles: - prometheus +- hosts: prometheus-rives.adm.auro.re + vars: + prometheus_alertmanager: docker-ovh.adm.auro.re:9093 + snmp_unifi_password: "{{ vault_snmp_unifi_password }}" + + # Prometheus targets.json + prometheus_ups_snmp_targets: + - ups-r3-1.ups.auro.re + + prometheus_targets: + - targets: | + {{ groups['rives_pve'] + groups['rives_vm'] | list | sort }} + prometheus_unifi_snmp_targets: + - targets: "{{ groups['rives_unifi'] | list | sort }}" + roles: + - prometheus + + # Monitor all hosts - hosts: all,!unifi,!ovh roles: diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 0b5ad0e..38deaa3 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -61,7 +61,7 @@ content: "{{ [{'targets': prometheus_ups_snmp_targets }] | to_nice_json }}\n" dest: /etc/prometheus/targets_ups_snmp.json mode: 0644 - + when: prometheus_ups_snmp_targets is defined - name: Activate prometheus service systemd: diff --git a/roles/prometheus/tasks/main.yml.save b/roles/prometheus/tasks/main.yml.save deleted file mode 100644 index cca66e5..0000000 --- a/roles/prometheus/tasks/main.yml.save +++ /dev/null @@ -1,76 +0,0 @@ ---- -- name: Install Prometheus - apt: - update_cache: true - name: - - prometheus - - prometheus-snmp-exporter - register: apt_result - retries: 3 - until: apt_result is succeeded - -- name: Configure Prometheus - 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 - - django.rules.yml - -- name: Make Prometheus snmp-exporter listen on localhost only - lineinfile: - path: /etc/default/prometheus-snmp-exporter - regexp: '^ARGS=' - line: "ARGS=\"--web.listen-address=127.0.0.1:9116\"" - notify: Restart prometheus-snmp-exporter - -# This file store SNMP OIDs -- name: Configure Prometheus snmp-exporter - template: - src: "prometheus/snmp.yml.j2" - dest: "/etc/prometheus/snmp.yml" - mode: 0600 - owner: prometheus - notify: Restart prometheus-snmp-exporter - -# We don't need to restart Prometheus when updating nodes -- name: Configure Prometheus nodes - copy: - content: "{{ prometheus_targets | to_nice_json }}" - dest: /etc/prometheus/targets.json - mode: 0644 - -# We don't need to restart Prometheus when updating nodes -- name: Configure Prometheus Ubiquity Unifi SNMP devices - copy: - content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}" - dest: /etc/prometheus/targets_unifi_snmp.json - mode: 0644 - -- name: Configure Prometheus UPS SNMP devices - copy: - content: "{{ [{'target | to_nice_json }}" - dest: /etc/prometheus/targets_ups_snmp.json - mode: 0644 - - -- name: Activate prometheus service - systemd: - name: prometheus - enabled: true - state: started - -- name: Indicate role in motd - template: - src: update-motd.d/05-service.j2 - dest: /etc/update-motd.d/05-prometheus - mode: 0755 diff --git a/roles/prometheus/templates/prometheus/alert.rules.yml.j2 b/roles/prometheus/templates/prometheus/alert.rules.yml.j2 index db99ab7..7ae1928 100644 --- a/roles/prometheus/templates/prometheus/alert.rules.yml.j2 +++ b/roles/prometheus/templates/prometheus/alert.rules.yml.j2 @@ -102,7 +102,7 @@ groups: summary: "La tension d'entrée de {{ $labels.instance }} est de {{ $value }}V." - alert: UpsWrongOutputVoltage - expr: (upsOutputVoltage < 225) or (upsOutputVoltage > 235) + expr: (upsOutputVoltage < 220) or (upsOutputVoltage > 240) for: 5m labels: severity: warning diff --git a/test.sh b/test.sh deleted file mode 100755 index 3e77d04..0000000 --- a/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -for ip in `cat hosts|grep pacaterie.adm.auro.re`; do - ssh-copy-id $ip -done - -- 2.45.2 From e3ae912f44d6b5f3db16f3b11cedf9178fcc08ad Mon Sep 17 00:00:00 2001 From: pz2891 Date: Sat, 23 Jan 2021 22:10:57 +0100 Subject: [PATCH 5/8] Add prometheus-aurore to monitor all service VM and physical servers. Modifying monitoring role to exclude wireless access points when running the role on all hosts --- hosts | 4 +++- monitoring.yml | 14 +++++++++++++- roles/prometheus/tasks/main.yml | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/hosts b/hosts index 6639a21..ad8b045 100644 --- a/hosts +++ b/hosts @@ -29,13 +29,15 @@ stream.adm.auro.re re2o-server.adm.auro.re re2o-ldap.adm.auro.re re2o-db.adm.auro.re -pendragon.adm.auro.re services-bdd-local.adm.auro.re backup.adm.auro.re services-web.adm.auro.re mail.adm.auro.re wikijs.adm.auro.re +prometheus-aurore.adm.auro.re +[aurore_testing_vm] +pendragon.adm.auro.re ############################################################################### # OVH diff --git a/monitoring.yml b/monitoring.yml index fc59738..a5e9a97 100755 --- a/monitoring.yml +++ b/monitoring.yml @@ -78,8 +78,20 @@ roles: - prometheus +- hosts: prometheus-aurore.adm.auro.re + vars: + prometheus_alertmanager: docker-ovh.adm.auro.re:9093 + snmp_unifi_password: "{{ vault_snmp_unifi_password }}" + + # Prometheus targets.json + prometheus_targets: + - targets: | + {{ groups['aurore_pve'] + groups['aurore_vm'] + groups['ovh_pve'] + groups['ovh_vm'] | list | sort }} + roles: + - prometheus + # Monitor all hosts -- hosts: all,!unifi,!ovh +- hosts: all,!edc_unifi,!fleming_unifi,!pacaterie_unifi,!gs_unifi,!rives_unifi,!aurore_testing_vm,!ovh_container roles: - prometheus_node diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 38deaa3..036b58c 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -55,6 +55,7 @@ content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}" dest: /etc/prometheus/targets_unifi_snmp.json mode: 0644 + when : prometheus_unifi_snmp_targets is defined - name: Configure Prometheus UPS SNMP devices copy: -- 2.45.2 From 3d05acbd03d1718af0bdde3cd955684912ba6864 Mon Sep 17 00:00:00 2001 From: pz2891 Date: Tue, 26 Jan 2021 19:18:35 +0100 Subject: [PATCH 6/8] Add Loki server --- hosts | 1 + monitoring.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/hosts b/hosts index ad8b045..ec09073 100644 --- a/hosts +++ b/hosts @@ -339,6 +339,7 @@ gf-5-1.borne.auro.re # Les Rives [rives_pve] thor.adm.auro.re +loki.adm.auro.re [rives_vm] dhcp-rives-backup.adm.auro.re diff --git a/monitoring.yml b/monitoring.yml index a5e9a97..38a019d 100755 --- a/monitoring.yml +++ b/monitoring.yml @@ -58,6 +58,8 @@ {{ groups['gs_pve'] + groups['gs_vm'] | list | sort }} prometheus_unifi_snmp_targets: - targets: "{{ groups['gs_unifi'] | list | sort }}" + prometheus_ups_snmp_targets: + - ups-gk-1.ups.auro.re roles: - prometheus -- 2.45.2 From a12bcbc97f4e5d1425ce543f5a6dd5417c500506 Mon Sep 17 00:00:00 2001 From: pz2891 Date: Fri, 29 Jan 2021 20:12:14 +0100 Subject: [PATCH 7/8] Correct yamlint --- monitoring.yml | 8 ++++---- roles/prometheus/tasks/main.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitoring.yml b/monitoring.yml index 38a019d..c31fe86 100755 --- a/monitoring.yml +++ b/monitoring.yml @@ -26,9 +26,9 @@ prometheus_unifi_snmp_targets: - targets: "{{ groups['pacaterie_unifi'] | list | sort }}" prometheus_ups_snmp_targets: - - ups-pn-1.ups.auro.re + - ups-pn-1.ups.auro.re roles: - - prometheus + - prometheus - hosts: prometheus-edc.adm.auro.re vars: @@ -37,7 +37,7 @@ # Prometheus targets.json prometheus_ups_snmp_targets: - - ups-ec-1.ups.auro.re + - ups-ec-1.ups.auro.re prometheus_targets: - targets: | @@ -70,7 +70,7 @@ # Prometheus targets.json prometheus_ups_snmp_targets: - - ups-r3-1.ups.auro.re + - ups-r3-1.ups.auro.re prometheus_targets: - targets: | diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 036b58c..8697ef9 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -55,7 +55,7 @@ content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}" dest: /etc/prometheus/targets_unifi_snmp.json mode: 0644 - when : prometheus_unifi_snmp_targets is defined + when: prometheus_unifi_snmp_targets is defined - name: Configure Prometheus UPS SNMP devices copy: -- 2.45.2 From eecf807b532657f02312e604f9bd7d86ef9fa0de Mon Sep 17 00:00:00 2001 From: pz2891 Date: Fri, 29 Jan 2021 20:15:21 +0100 Subject: [PATCH 8/8] Delte main.yml.save --- roles/baseconfig/tasks/main.yml.save | 89 ---------------------------- 1 file changed, 89 deletions(-) delete mode 100644 roles/baseconfig/tasks/main.yml.save diff --git a/roles/baseconfig/tasks/main.yml.save b/roles/baseconfig/tasks/main.yml.save deleted file mode 100644 index d73cf07..0000000 --- a/roles/baseconfig/tasks/main.yml.save +++ /dev/null @@ -1,89 +0,0 @@ ---- -# Should contain only small tools that everyone can't live without -- name: Install basic tools - when: ansible_os_family == "Debian" - apt: - name: - - sudo - - molly-guard # prevent reboot - - ntp # network time sync - - apt # better than apt-get - - nano # for vulcain - - vim # better than nano - - emacs-nox # for maman - - htop # better than top - - zsh # to be able to ssh @erdnaxe - - fish # to motivate @edpibu - - oidentd # postgresql identification - - aptitude # nice to have for Ansible - - acl # advanced ACL - - iotop # monitor i/o - - tree # create a graphical tree of files - - bash-completion # because bash - - git # code versioning - - less # i like cats - - screen # Vulcain asked for this - - lsb-release - update_cache: true - register: apt_result - retries: 3 - until: apt_result is succeeded - -# Pimp my server -- name: Customize motd - copy: - src: "update-motd.d/{{ item }}" - dest: "/etc/update-motd.d/{{ item }}" - mode: 0755 - loop: - - 00-logo - - 10-uname - -- name: Remove Debian warranty motd - file: - path: /etc/motd - state: absent - -# Configure APT mirrors on Debian Stretch -- name: Configure APT mirrors - when: - - ansible_distribution == 'Debian' - - ansible_distribution_release == 'stretch' - template: - src: apt/sources.list.j2 - dest: /etc/apt/sources.list - mode: 0644 - -# Patriotisme -- name: Ensure French UTF-8 locale exists - locale_gen: - name: fr_FR.UTF-8 - state: present - -# Fix LC_CTYPE="C" -- name: Select default locale - debconf: - name: locales - question: locales/default_environment_locale - value: fr_FR.UTF-8 - vtype: select - notify: Reconfigure locales - -# APT-List Changes : send email with changelog -- include_tasks: apt-listchanges.yml - -# User skeleton -- name: Configure user skeleton - copy: - src: "skel/dot_{{ item }}" - dest: "/etc/skel/.{{ item }}" - mode: 0644 - loop: - - zshrc - - zshrc.local - -- name: Configure resolvconf - template: - src: resolv.conf - dest: /etc/resolv.conf - mode: 0644 -- 2.45.2