1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-11-21 17:21:01 +01:00

install node exporter 1.0.1 and write webconfig

This commit is contained in:
s3lph 2020-11-13 11:34:25 +01:00
parent 439f5a1c48
commit 8310af201b
9 changed files with 80 additions and 9 deletions

View file

@ -39,7 +39,8 @@ tags:
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}
dependencies:
git@gitlab.com:s3lph/ansible-collection-pki: master
# The URL of the originating SCM repository
repository: https://gitlab.com/s3lph/ansible-collection-prometheus

29
playbooks/monitoring.yml Normal file
View file

@ -0,0 +1,29 @@
---
- hosts: localhost
roles:
- s3lph.pki.pki_ca
- hosts: new_nodes
strategy: free
roles:
- s3lph.pki.pki_entity
- hosts: all_nodes
strategy: free
roles:
- s3lph.prometheus.prometheus_node
- hosts: openbsd_node
strategy: free
roles:
- s3lph.prometheus.prometheus_node_openbsd
- hosts: alertmanagers
strategy: free
roles:
- s3lph.prometheus.alertmanager
- hosts: prometheus
roles:
- s3lph.prometheus.prometheus

View file

@ -8,3 +8,8 @@ smartmon_exporter_force_off: no
prometheus_hpsa_collector: no
prometheus_textfile_collectors: {}
prometheus_node_tls_cert: null
prometheus_node_tls_key: null
prometheus_node_tls_require_cert: no
prometheus_node_tls_ca: null

View file

@ -1,5 +1,10 @@
---
- name: render /etc/prometheus/tls/config.yml
template:
src: prometheus-node-exporter-webconfig.yml.j2
dest: /etc/prometheus/tls/config.yml
- name: render /etc/default/prometheus-node-exporter
template:
src: prometheus-node-exporter.default.j2

View file

@ -1,10 +1,31 @@
---
- name: install prometheus-node-exporter
- name: check if package files already exist
stat:
path: "/root/{{ item.name }}_{{ item.version }}_amd64.deb"
loop:
- name: prometheus-node-exporter
version: 1.0.1+ds-1
- name: prometheus-node-exporter-collectors
version: 0+git20201003.8db38d1
register: prometheus_node_register_ucs_deb_stat
- name: download packages
get_url:
url: "https://{{ debian_mirror }}/debian/pool/main/{{ pfirst | urlencode() }}/{{ package | urlencode() }}/{{ package | urlencode() }}_{{ version | urlencode() }}_amd64.deb" # noqa 204
dest: "/root/{{ package }}_{{ version }}_amd64.deb"
vars:
pfirst: "{{ item.item.name[:1] }}"
package: "{{ item.item.name }}"
version: "{{ item.item.version }}"
when: not item.stat.exists
loop: "{{ prometheus_node_register_ucs_deb_stat.results }}"
- name: install packages
apt:
name: prometheus-node-exporter
state: present
update_cache: yes
deb: "/root/{{ item.item.name }}_{{ item.item.version }}_amd64.deb"
loop: "{{ prometheus_node_register_ucs_deb_stat.results }}"
- name: start prometheus-node-exporter.service
systemd:

View file

@ -13,7 +13,7 @@
import_tasks: debian11.yml
when:
- "ansible_lsb.id == 'Debian' or ansible_lsb.id == 'Raspbian'"
- "ansible_lsb.major_release | int == 11"
- "ansible_lsb.major_release | int >= 11"
tags:
- "role::prometheus_node"
- "role::prometheus_node:debian"

View file

@ -5,9 +5,11 @@
path: "/root/{{ item.name }}_{{ item.version }}_amd64.deb"
loop:
- name: prometheus-node-exporter
version: 0.17.0+ds-3+b11
version: 1.0.1+ds-1
- name: prometheus-node-exporter-collectors
version: 0+git20201003.8db38d1
- name: moreutils
version: 0.62-1
version: 0.64-1
register: prometheus_node_register_ucs_deb_stat
- name: download packages

View file

@ -0,0 +1,8 @@
---
{{ ansible_managed | comment }}
tls_server_config:
cert_file: "{{ prometheus_node_tls_cert }}"
key_file: "{{ prometheus_node_tls_key }}"
client_auth_type: "{{ prometheus_node_tls_require_cert | ternary('RequireAndVerifyClientCert', 'NoClientCert') }}"
client_ca_file: "{{ prometheus_node_tls_ca }}"

View file

@ -1,3 +1,3 @@
{{ ansible_managed | comment }}
ARGS="{% for k, v in args.items() %}--{{ k }}=\"{{ v }}\" {% endfor %}"
ARGS="{% for k, v in args.items() %}--{{ k }}=\"{{ v }}\" {% endfor %} --web.config=/etc/prometheus/tls/config.yml"