Add prometheus user and group variable. General clean up
This commit is contained in:
parent
ba6876042d
commit
ad89540879
8 changed files with 48 additions and 31 deletions
|
@ -1,5 +1,4 @@
|
||||||
{% from "prometheus/map.jinja" import prometheus with context %}
|
{% from "prometheus/map.jinja" import prometheus with context %}
|
||||||
{%- set version_path = prometheus.alertmanager.install_dir ~ "/alertmanager-" ~ prometheus.alertmanager.version %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- prometheus.user
|
- prometheus.user
|
||||||
|
@ -10,20 +9,20 @@ alertmanager_tarball:
|
||||||
- source: {{ prometheus.alertmanager.source }}
|
- source: {{ prometheus.alertmanager.source }}
|
||||||
- source_hash: {{ prometheus.alertmanager.source_hash }}
|
- source_hash: {{ prometheus.alertmanager.source_hash }}
|
||||||
- archive_format: tar
|
- archive_format: tar
|
||||||
- if_missing: {{ version_path }}
|
- if_missing: {{ prometheus.alertmanager.version_path }}
|
||||||
|
|
||||||
alertmanager_bin_link:
|
alertmanager_bin_link:
|
||||||
file.symlink:
|
file.symlink:
|
||||||
- name: /usr/bin/alertmanager
|
- name: /usr/bin/alertmanager
|
||||||
- target: {{ version_path }}/alertmanager
|
- target: {{ prometheus.alertmanager.version_path }}/alertmanager
|
||||||
- require:
|
- require:
|
||||||
- archive: alertmanager_tarball
|
- archive: alertmanager_tarball
|
||||||
|
|
||||||
alertmanager_config:
|
alertmanager_config:
|
||||||
file.serialize:
|
file.serialize:
|
||||||
- name: {{ prometheus.alertmanager.args.config_file }}
|
- name: {{ prometheus.alertmanager.args.config_file }}
|
||||||
- user: prometheus
|
- user: {{ prometheus.user }}
|
||||||
- group: prometheus
|
- group: {{ prometheus.group }}
|
||||||
- dataset_pillar: prometheus:alertmanager:config
|
- dataset_pillar: prometheus:alertmanager:config
|
||||||
|
|
||||||
alertmanager_config:
|
alertmanager_config:
|
||||||
|
@ -31,8 +30,8 @@ alertmanager_config:
|
||||||
- name: {{ prometheus.alertmanager.args.config_file }}
|
- name: {{ prometheus.alertmanager.args.config_file }}
|
||||||
- source: salt://prometheus/files/config.jinja
|
- source: salt://prometheus/files/config.jinja
|
||||||
- template: jinja
|
- template: jinja
|
||||||
- user: prometheus
|
- user: {{ prometheus.user }}
|
||||||
- group: prometheus
|
- group: {{ prometheus.group }}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- defaults:
|
- defaults:
|
||||||
data: {{ prometheus.alertmanager.config }}
|
data: {{ prometheus.alertmanager.config }}
|
||||||
|
@ -49,8 +48,8 @@ alertmanager_defaults:
|
||||||
alertmanager_storage_path:
|
alertmanager_storage_path:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ prometheus.alertmanager.args.storage.path }}
|
- name: {{ prometheus.alertmanager.args.storage.path }}
|
||||||
- user: prometheus
|
- user: {{ prometheus.user }}
|
||||||
- group: prometheus
|
- group: {{ prometheus.group }}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- watch:
|
- watch:
|
||||||
- file: alertmanager_defaults
|
- file: alertmanager_defaults
|
||||||
|
@ -75,5 +74,6 @@ alertmanager_service:
|
||||||
- enable: True
|
- enable: True
|
||||||
- reload: True
|
- reload: True
|
||||||
- watch:
|
- watch:
|
||||||
|
- file: alertmanager_service_unit
|
||||||
- file: alertmanager_config
|
- file: alertmanager_config
|
||||||
- file: alertmanager_bin_link
|
- file: alertmanager_bin_link
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
prometheus:
|
prometheus:
|
||||||
|
user: prometheus
|
||||||
|
group: prometheus
|
||||||
server:
|
server:
|
||||||
version: 1.4.1.linux-amd64
|
version: 1.4.1.linux-amd64
|
||||||
install_dir: /opt
|
install_dir: /opt
|
||||||
|
@ -17,7 +19,7 @@ prometheus:
|
||||||
config_file: /etc/alertmanager/alertmanager.yml
|
config_file: /etc/alertmanager/alertmanager.yml
|
||||||
storage:
|
storage:
|
||||||
path: /var/lib/alertmanager
|
path: /var/lib/alertmanager
|
||||||
exporters:
|
exporter:
|
||||||
node:
|
node:
|
||||||
version: 0.13.0.linux-amd64
|
version: 0.13.0.linux-amd64
|
||||||
install_dir: /opt
|
install_dir: /opt
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{% from "prometheus/map.jinja" import prometheus with context %}
|
{% from "prometheus/map.jinja" import prometheus with context %}
|
||||||
{%- set version_path = prometheus.exporters.blackbox.install_dir ~ "/blackbox_exporter-" ~ prometheus.exporters.blackbox.version %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- prometheus.user
|
- prometheus.user
|
||||||
|
@ -9,13 +8,15 @@ blackbox_exporter_tarball:
|
||||||
- name: {{ prometheus.exporters.blackbox.install_dir }}
|
- name: {{ prometheus.exporters.blackbox.install_dir }}
|
||||||
- source: {{ prometheus.exporters.blackbox.source }}
|
- source: {{ prometheus.exporters.blackbox.source }}
|
||||||
- source_hash: {{ prometheus.exporters.blackbox.source_hash }}
|
- source_hash: {{ prometheus.exporters.blackbox.source_hash }}
|
||||||
|
- user: {{ prometheus.user }}
|
||||||
|
- group: {{ prometheus.group }}
|
||||||
- archive_format: tar
|
- archive_format: tar
|
||||||
- if_missing: {{ version_path }}
|
- if_missing: {{ prometheus.exporter.blackbox.version_path }}
|
||||||
|
|
||||||
blackbox_exporter_bin_link:
|
blackbox_exporter_bin_link:
|
||||||
file.symlink:
|
file.symlink:
|
||||||
- name: /usr/bin/blackbox_exporter
|
- name: /usr/bin/blackbox_exporter
|
||||||
- target: {{ version_path }}/blackbox_exporter
|
- target: {{ prometheus.exporter.blackbox.version_path }}/blackbox_exporter
|
||||||
- require:
|
- require:
|
||||||
- archive: blackbox_exporter_tarball
|
- archive: blackbox_exporter_tarball
|
||||||
|
|
||||||
|
@ -45,5 +46,6 @@ blackbox_exporter_service:
|
||||||
- enable: True
|
- enable: True
|
||||||
- reload: True
|
- reload: True
|
||||||
- watch:
|
- watch:
|
||||||
|
- file: blackbox_exporter_service_unit
|
||||||
- file: blackbox_exporter_defaults
|
- file: blackbox_exporter_defaults
|
||||||
- file: blackbox_exporter_bin_link
|
- file: blackbox_exporter_bin_link
|
|
@ -1,5 +1,4 @@
|
||||||
{% from "prometheus/map.jinja" import prometheus with context %}
|
{% from "prometheus/map.jinja" import prometheus with context %}
|
||||||
{%- set version_path = prometheus.exporters.haproxy.install_dir ~ "/haproxy_exporter-" ~ prometheus.exporters.haproxy.version %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- prometheus.user
|
- prometheus.user
|
||||||
|
@ -9,13 +8,15 @@ haproxy_exporter_tarball:
|
||||||
- name: {{ prometheus.exporters.haproxy.install_dir }}
|
- name: {{ prometheus.exporters.haproxy.install_dir }}
|
||||||
- source: {{ prometheus.exporters.haproxy.source }}
|
- source: {{ prometheus.exporters.haproxy.source }}
|
||||||
- source_hash: {{ prometheus.exporters.haproxy.source_hash }}
|
- source_hash: {{ prometheus.exporters.haproxy.source_hash }}
|
||||||
|
- user: {{ prometheus.user }}
|
||||||
|
- group: {{ prometheus.group }}
|
||||||
- archive_format: tar
|
- archive_format: tar
|
||||||
- if_missing: {{ version_path }}
|
- if_missing: {{ prometheus.exporter.haproxy.version_path }}
|
||||||
|
|
||||||
haproxy_exporter_bin_link:
|
haproxy_exporter_bin_link:
|
||||||
file.symlink:
|
file.symlink:
|
||||||
- name: /usr/bin/haproxy_exporter
|
- name: /usr/bin/haproxy_exporter
|
||||||
- target: {{ version_path }}/haproxy_exporter
|
- target: {{ prometheus.exporter.haproxy.version_path }}/haproxy_exporter
|
||||||
- require:
|
- require:
|
||||||
- archive: haproxy_exporter_tarball
|
- archive: haproxy_exporter_tarball
|
||||||
|
|
||||||
|
@ -45,5 +46,6 @@ haproxy_exporter_service:
|
||||||
- enable: True
|
- enable: True
|
||||||
- reload: True
|
- reload: True
|
||||||
- watch:
|
- watch:
|
||||||
|
- file: haproxy_exporter_service_unit
|
||||||
- file: haproxy_exporter_defaults
|
- file: haproxy_exporter_defaults
|
||||||
- file: haproxy_exporter_bin_link
|
- file: haproxy_exporter_bin_link
|
|
@ -1,5 +1,4 @@
|
||||||
{% from "prometheus/map.jinja" import prometheus with context %}
|
{% from "prometheus/map.jinja" import prometheus with context %}
|
||||||
{%- set version_path = prometheus.exporters.node.install_dir ~ "/node_exporter-" ~ prometheus.exporters.node.version %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- prometheus.user
|
- prometheus.user
|
||||||
|
@ -9,13 +8,15 @@ node_exporter_tarball:
|
||||||
- name: {{ prometheus.exporters.node.install_dir }}
|
- name: {{ prometheus.exporters.node.install_dir }}
|
||||||
- source: {{ prometheus.exporters.node.source }}
|
- source: {{ prometheus.exporters.node.source }}
|
||||||
- source_hash: {{ prometheus.exporters.node.source_hash }}
|
- source_hash: {{ prometheus.exporters.node.source_hash }}
|
||||||
|
- user: {{ prometheus.user }}
|
||||||
|
- group: {{ prometheus.group }}
|
||||||
- archive_format: tar
|
- archive_format: tar
|
||||||
- if_missing: {{ version_path }}
|
- if_missing: {{ prometheus.exporter.node.version_path }}
|
||||||
|
|
||||||
node_exporter_bin_link:
|
node_exporter_bin_link:
|
||||||
file.symlink:
|
file.symlink:
|
||||||
- name: /usr/bin/node_exporter
|
- name: /usr/bin/node_exporter
|
||||||
- target: {{ version_path }}/node_exporter
|
- target: {{ prometheus.exporter.node.version_path }}/node_exporter
|
||||||
- require:
|
- require:
|
||||||
- archive: node_exporter_tarball
|
- archive: node_exporter_tarball
|
||||||
|
|
||||||
|
@ -43,5 +44,6 @@ node_exporter_service:
|
||||||
- enable: True
|
- enable: True
|
||||||
- reload: True
|
- reload: True
|
||||||
- watch:
|
- watch:
|
||||||
|
- file: node_exporter_service_unit
|
||||||
- file: node_exporter_defaults
|
- file: node_exporter_defaults
|
||||||
- file: node_exporter_bin_link
|
- file: node_exporter_bin_link
|
|
@ -1,3 +1,10 @@
|
||||||
{% import_yaml 'prometheus/defaults.yaml' as defaults %}
|
{% import_yaml 'prometheus/defaults.yaml' as defaults %}
|
||||||
|
|
||||||
|
{% do defaults.prometheus.alertmanager.update('version_path': defaults.prometheus.alertmanager.install_dir ~ "/alertmanager-" ~ defaults.prometheus.alertmanager.version) %}
|
||||||
|
{% do defaults.prometheus.server.update('version_path': defaults.prometheus.server.install_dir ~ "/prometheus-" ~ defaults.prometheus.server.version) %}
|
||||||
|
|
||||||
|
{% do defaults.prometheus.exporter.node.update('version_path': defaults.prometheus.exporter.node.install_dir ~ "/node_exporter-" ~ defaults.prometheus.exporter.node.version) %}
|
||||||
|
{% do defaults.prometheus.exporter.blackbox.update('version_path': defaults.prometheus.exporter.blackbox.install_dir ~ "/blackbox_exporter-" ~ defaults.prometheus.exporter.blackbox.version) %}
|
||||||
|
{% do defaults.prometheus.exporter.haproxy.update('version_path': defaults.prometheus.exporter.haproxy.install_dir ~ "/haproxy_exporter-" ~ defaults.prometheus.exporter.haproxy.version) %}
|
||||||
|
|
||||||
{% set prometheus = salt['pillar.get']('prometheus', default=defaults.prometheus, merge=True) %}
|
{% set prometheus = salt['pillar.get']('prometheus', default=defaults.prometheus, merge=True) %}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{% from "prometheus/map.jinja" import prometheus with context %}
|
{% from "prometheus/map.jinja" import prometheus with context %}
|
||||||
{%- set version_path = prometheus.server.install_dir ~ "/prometheus-" ~ prometheus.server.version %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- prometheus.user
|
- prometheus.user
|
||||||
|
@ -10,20 +9,20 @@ prometheus_server_tarball:
|
||||||
- source: {{ prometheus.server.source }}
|
- source: {{ prometheus.server.source }}
|
||||||
- source_hash: {{ prometheus.server.source_hash }}
|
- source_hash: {{ prometheus.server.source_hash }}
|
||||||
- archive_format: tar
|
- archive_format: tar
|
||||||
- if_missing: {{ version_path }}
|
- if_missing: {{ prometheus.server.version_path }}
|
||||||
|
|
||||||
prometheus_bin_link:
|
prometheus_bin_link:
|
||||||
file.symlink:
|
file.symlink:
|
||||||
- name: /usr/bin/prometheus
|
- name: /usr/bin/prometheus
|
||||||
- target: {{ version_path }}/prometheus
|
- target: {{ prometheus.server.version_path }}/prometheus
|
||||||
- require:
|
- require:
|
||||||
- archive: prometheus_server_tarball
|
- archive: prometheus_server_tarball
|
||||||
|
|
||||||
prometheus_server_config:
|
prometheus_server_config:
|
||||||
file.serialize:
|
file.serialize:
|
||||||
- name: {{ prometheus.server.args.config_file }}
|
- name: {{ prometheus.server.args.config_file }}
|
||||||
- user: prometheus
|
- user: {{ prometheus.user }}
|
||||||
- group: prometheus
|
- group: {{ prometheus.group }}
|
||||||
- dataset_pillar: prometheus:server:config
|
- dataset_pillar: prometheus:server:config
|
||||||
|
|
||||||
prometheus_defaults:
|
prometheus_defaults:
|
||||||
|
@ -34,15 +33,15 @@ prometheus_defaults:
|
||||||
- defaults:
|
- defaults:
|
||||||
config_file: {{ prometheus.server.args.config_file }}
|
config_file: {{ prometheus.server.args.config_file }}
|
||||||
storage_local_path: {{ prometheus.server.args.storage.local_path }}
|
storage_local_path: {{ prometheus.server.args.storage.local_path }}
|
||||||
web_console_libraries: {{ version_path }}/console_libraries
|
web_console_libraries: {{ prometheus.server.version_path }}/console_libraries
|
||||||
web_console_templates: {{ version_path }}/consoles
|
web_console_templates: {{ prometheus.server.version_path }}/consoles
|
||||||
|
|
||||||
{%- if prometheus.server.args.storage.local_path is defined %}
|
{%- if prometheus.server.args.storage.local_path is defined %}
|
||||||
prometheus_storage_local_path:
|
prometheus_storage_local_path:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ prometheus.server.args.storage.local_path }}
|
- name: {{ prometheus.server.args.storage.local_path }}
|
||||||
- user: prometheus
|
- user: {{ prometheus.user }}
|
||||||
- group: prometheus
|
- group: {{ prometheus.group }}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- watch:
|
- watch:
|
||||||
- file: prometheus_defaults
|
- file: prometheus_defaults
|
||||||
|
@ -68,5 +67,6 @@ prometheus_service:
|
||||||
- enable: True
|
- enable: True
|
||||||
- reload: True
|
- reload: True
|
||||||
- watch:
|
- watch:
|
||||||
|
- file: prometheus_service_unit
|
||||||
- file: prometheus_server_config
|
- file: prometheus_server_config
|
||||||
- file: prometheus_bin_link
|
- file: prometheus_bin_link
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
prometheus_group:
|
prometheus_group:
|
||||||
group.present:
|
group.present:
|
||||||
- name: prometheus
|
- name: {{ prometheus.group }}
|
||||||
|
- system: True
|
||||||
|
|
||||||
prometheus_user:
|
prometheus_user:
|
||||||
user.present:
|
user.present:
|
||||||
- name: prometheus
|
- name: {{ prometheus.user }}
|
||||||
- home: /var/lib/prometheus
|
- home: /var/lib/prometheus
|
||||||
- gid_from_name: True
|
- gid: {{ prometheus.group }}
|
||||||
|
- system: True
|
||||||
|
|
Loading…
Reference in a new issue