1596475db6
This patch extends the prometheus role for being able to deploy the prometheus-alertmanager[0] container. The variable enable_prometheus_alertmanager decides if the container should be deployed and enabled. If enabled, the following configuration and actions are performed: - The alerting section on the prometheus-server configuration is added pointing the prometheus-alertmanager host group as targets. - HAProxy is configured to load-balance over the prometheus-alertmanager host group. (external/internal). Please note that a default (dummy) configuration is provided, that allows the service to start, the operator should extend it via a node custom config [0] https://github.com/openstack/kolla/tree/master/docker/prometheus/prometheus-alertmanager Change-Id: I3a13342c67744a278cc8d52900a913c3ccc452ae Closes-Bug: 1774725 Signed-off-by: Jorge Niedbalski <jorge.niedbalski@linaro.org>
142 lines
5.8 KiB
YAML
142 lines
5.8 KiB
YAML
---
|
|
- name: Restart prometheus-server container
|
|
vars:
|
|
service_name: "prometheus-server"
|
|
service: "{{ prometheus_services[service_name] }}"
|
|
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or prometheus_confs.changed | bool
|
|
or prometheus_container.changed | bool
|
|
|
|
- name: Restart prometheus-node-exporter container
|
|
vars:
|
|
service_name: "prometheus-node-exporter"
|
|
service: "{{ prometheus_services[service_name] }}"
|
|
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
pid_mode: "{{ service.pid_mode | default(emit) }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or prometheus_container.changed | bool
|
|
|
|
- name: Restart prometheus-mysqld-exporter container
|
|
vars:
|
|
service_name: "prometheus-mysqld-exporter"
|
|
service: "{{ prometheus_services[service_name] }}"
|
|
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or prometheus_conf_mycnf.changed | bool
|
|
or prometheus_container.changed | bool
|
|
|
|
- name: Restart prometheus-haproxy-exporter container
|
|
vars:
|
|
service_name: "prometheus-haproxy-exporter"
|
|
service: "{{ prometheus_services[service_name] }}"
|
|
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or prometheus_container.changed | bool
|
|
|
|
- name: Restart prometheus-memcached-exporter container
|
|
vars:
|
|
service_name: "prometheus-memcached-exporter"
|
|
service: "{{ prometheus_services[service_name] }}"
|
|
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
become: true
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or prometheus_container.changed | bool
|
|
|
|
- name: Restart prometheus-cadvisor container
|
|
vars:
|
|
service_name: "prometheus-cadvisor"
|
|
service: "{{ prometheus_services[service_name] }}"
|
|
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or prometheus_container.changed | bool
|
|
|
|
- name: Restart prometheus-alertmanager container
|
|
vars:
|
|
service_name: "prometheus-alertmanager"
|
|
service: "{{ prometheus_services[service_name] }}"
|
|
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- kolla_action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or prometheus_container.changed | bool
|