From 30144947402928c11affa1b70939dfc6c0ecbe57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20B=C3=A9rtoli?= Date: Fri, 21 Aug 2020 10:33:20 -0300 Subject: [PATCH] feat(debian): allow to install using OS packages --- prometheus/map.jinja | 2 +- prometheus/osfamilymap.yaml | 69 ++++++++++++++++++++++++++--- prometheus/package/repo/install.sls | 23 +++++++--- 3 files changed, 82 insertions(+), 12 deletions(-) diff --git a/prometheus/map.jinja b/prometheus/map.jinja index 6212ada..f9d2478 100644 --- a/prometheus/map.jinja +++ b/prometheus/map.jinja @@ -30,9 +30,9 @@ {%- set uri = '%s/%s/releases/download/%s/%s'|format(p.pkg.uri, name, v.version, name) %} {%- set url = '%s-%s.%s-%s.tar.gz'|format(uri, v.version|replace('v',''), p.kernel, p.arch) %} {%- set dir = '%s-%s'|format(name, v.version) %} - {%- endif %} {%- do p.pkg.component[name].update({'path': p.dir.archive ~ '/' + dir }) %} {%- do p.pkg.component[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %} + {%- endif %} {%- endfor %} {%- endif %} diff --git a/prometheus/osfamilymap.yaml b/prometheus/osfamilymap.yaml index 0630d04..b61465b 100644 --- a/prometheus/osfamilymap.yaml +++ b/prometheus/osfamilymap.yaml @@ -25,14 +25,73 @@ Debian: - cron use_upstream_repo: false use_upstream_package: false - use_upstream_archive: true - repo: - humanname: 'prometheus repository' - key_url: 'https://s3-eu-west-1.amazonaws.com/deb.robustperception.io/41EFC99D.gpg' - file: /etc/apt/sources.list.d/prometheus.list + use_upstream_archive: false component: + prometheus: + name: prometheus + alertmanager: + name: prometheus-alertmanager + apache_exporter: + name: prometheus-apache-exporter + bind_exporter: + name: prometheus-bind-exporter + bird_exporter: + name: prometheus-bird-exporter + blackbox_exporter: + name: prometheus-blackbox-exporter + hacluster_exporter: + name: prometheus-hacluster-exporter + haproxy_exporter: + name: prometheus-haproxy-exporter + homeplug_exporter: + name: prometheus-homeplug-exporter + ipmi_exporter: + name: prometheus-ipmi-exporter + libvirt_exporter: + name: prometheus-libvirt-exporter + mailexporter: + name: prometheus-mailexporter + mongodb_exporter: + name: prometheus-mongodb-exporter + mysqld_exporter: + name: prometheus-mysqld-exporter + nginx_exporter: + name: prometheus-nginx-exporter + nginx_vts_exporter: + name: prometheus-nginx-vts-exporter node_exporter: + name: prometheus-node-exporter args_file: /etc/default/prometheus-node-exporter + node_exporter_collectors: + name: prometheus-node-exporter-collectors + openstack_exporter: + name: prometheus-openstack-exporter + pgbouncer_exporter: + name: prometheus-pgbouncer-exporter + postfix_exporter: + name: prometheus-postfix-exporter + postgres_exporter: + name: prometheus-postgres-exporter + process_exporter: + name: prometheus-process-exporter + pushgateway: + name: prometheus-pushgateway + snmp_exporter: + name: prometheus-snmp-exporter + sql_exporter: + name: prometheus-sql-exporter + squid_exporter: + name: prometheus-squid-exporter + tplink_plug_exporter: + name: prometheus-tplink-plug-exporter + trafficserver_exporter: + name: prometheus-trafficserver-exporter + varnish_exporter: + name: prometheus-varnish-exporter + xmpp_alerts: + name: prometheus-xmpp-alerts + + exporters: node_exporter: textfile_collectors_dependencies: diff --git a/prometheus/package/repo/install.sls b/prometheus/package/repo/install.sls index 555d489..73ed856 100644 --- a/prometheus/package/repo/install.sls +++ b/prometheus/package/repo/install.sls @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- # vim: ft=sls -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import prometheus as p with context %} +{%- if grains.os_family == 'RedHat' %} - {%- if p.pkg.use_upstream_repo and 'repo' in p.pkg and p.pkg.repo %} - {%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %} + {%- set tplroot = tpldir.split('/')[0] %} + {%- from tplroot ~ "/map.jinja" import prometheus as p with context %} + + {%- if p.pkg.use_upstream_repo and 'repo' in p.pkg and p.pkg.repo %} + {%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %} prometheus-package-repo-install-pkgrepo-managed: pkgrepo.managed: @@ -16,6 +18,15 @@ prometheus-package-repo-install-pkgrepo-managed: - pattern: ' gpgkey2=' - repl: '\n ' - ignore_if_missing: True - - onlyif: {{ grains.os_family == 'RedHat' }} + {%- endif %} - {%- endif %} +{%- else %} + +prometheus-package-repo-install-pkgrepo-managed: + test.show_notification: + - name: Skipping repository configuration + - text: | + At the moment, there's no repo for {{ grains['os'] }} + See https://prometheus.io/download/ + +{%- endif %}