mirror of
https://gitlab.com/s3lph/ansible-collection-prometheus
synced 2024-11-22 01:31:01 +01:00
install node exporter 1.0.1 and write webconfig
This commit is contained in:
parent
439f5a1c48
commit
8310af201b
9 changed files with 80 additions and 9 deletions
|
@ -39,7 +39,8 @@ tags:
|
||||||
# collection label 'namespace.name'. The value is a version range
|
# collection label 'namespace.name'. The value is a version range
|
||||||
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
|
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
|
||||||
# range specifiers can be set and are separated by ','
|
# 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
|
# The URL of the originating SCM repository
|
||||||
repository: https://gitlab.com/s3lph/ansible-collection-prometheus
|
repository: https://gitlab.com/s3lph/ansible-collection-prometheus
|
||||||
|
|
29
playbooks/monitoring.yml
Normal file
29
playbooks/monitoring.yml
Normal 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
|
|
@ -8,3 +8,8 @@ smartmon_exporter_force_off: no
|
||||||
prometheus_hpsa_collector: no
|
prometheus_hpsa_collector: no
|
||||||
|
|
||||||
prometheus_textfile_collectors: {}
|
prometheus_textfile_collectors: {}
|
||||||
|
|
||||||
|
prometheus_node_tls_cert: null
|
||||||
|
prometheus_node_tls_key: null
|
||||||
|
prometheus_node_tls_require_cert: no
|
||||||
|
prometheus_node_tls_ca: null
|
||||||
|
|
|
@ -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
|
- name: render /etc/default/prometheus-node-exporter
|
||||||
template:
|
template:
|
||||||
src: prometheus-node-exporter.default.j2
|
src: prometheus-node-exporter.default.j2
|
||||||
|
|
|
@ -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:
|
apt:
|
||||||
name: prometheus-node-exporter
|
deb: "/root/{{ item.item.name }}_{{ item.item.version }}_amd64.deb"
|
||||||
state: present
|
loop: "{{ prometheus_node_register_ucs_deb_stat.results }}"
|
||||||
update_cache: yes
|
|
||||||
|
|
||||||
- name: start prometheus-node-exporter.service
|
- name: start prometheus-node-exporter.service
|
||||||
systemd:
|
systemd:
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
import_tasks: debian11.yml
|
import_tasks: debian11.yml
|
||||||
when:
|
when:
|
||||||
- "ansible_lsb.id == 'Debian' or ansible_lsb.id == 'Raspbian'"
|
- "ansible_lsb.id == 'Debian' or ansible_lsb.id == 'Raspbian'"
|
||||||
- "ansible_lsb.major_release | int == 11"
|
- "ansible_lsb.major_release | int >= 11"
|
||||||
tags:
|
tags:
|
||||||
- "role::prometheus_node"
|
- "role::prometheus_node"
|
||||||
- "role::prometheus_node:debian"
|
- "role::prometheus_node:debian"
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
path: "/root/{{ item.name }}_{{ item.version }}_amd64.deb"
|
path: "/root/{{ item.name }}_{{ item.version }}_amd64.deb"
|
||||||
loop:
|
loop:
|
||||||
- name: prometheus-node-exporter
|
- 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
|
- name: moreutils
|
||||||
version: 0.62-1
|
version: 0.64-1
|
||||||
register: prometheus_node_register_ucs_deb_stat
|
register: prometheus_node_register_ucs_deb_stat
|
||||||
|
|
||||||
- name: download packages
|
- name: download packages
|
||||||
|
|
|
@ -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 }}"
|
|
@ -1,3 +1,3 @@
|
||||||
{{ ansible_managed | comment }}
|
{{ 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"
|
||||||
|
|
Loading…
Reference in a new issue