defaults: change default grafana-server name

This change default value of grafana-server group name.
Adding some tasks in ceph-defaults in order to keep backward
compatibility.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/5821/head
Guillaume Abrioux 2020-07-25 00:05:41 +02:00
parent 902575369c
commit eefe11d90c
31 changed files with 89 additions and 68 deletions

2
Vagrantfile vendored
View File

@ -60,7 +60,7 @@ ansible_provision = proc do |ansible|
'clients' => (0..CLIENTS - 1).map { |j| "#{LABEL_PREFIX}client#{j}" },
'iscsigws' => (0..NISCSI_GWS - 1).map { |j| "#{LABEL_PREFIX}iscsi_gw#{j}" },
'mgrs' => (0..MGRS - 1).map { |j| "#{LABEL_PREFIX}mgr#{j}" },
'grafana-server' => (0..GRAFANA - 1).map { |j| "#{LABEL_PREFIX}grafana#{j}" }
'monitoring' => (0..GRAFANA - 1).map { |j| "#{LABEL_PREFIX}grafana#{j}" }
}
ansible.extra_vars = {

View File

@ -47,7 +47,7 @@
status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: "{{ grafana_server_group_name }}"
- hosts: "{{ monitoring_group_name }}"
gather_facts: false
become: true
pre_tasks:

View File

@ -57,7 +57,7 @@ dummy:
#iscsi_gw_group_name: iscsigws
#mgr_group_name: mgrs
#rgwloadbalancer_group_name: rgwloadbalancers
#grafana_server_group_name: grafana-server
#monitoring_group_name: monitoring
# If configure_firewall is true, then ansible will try to configure the
# appropriate firewalling rules so that Ceph daemons can communicate

View File

@ -57,7 +57,7 @@ fetch_directory: ~/ceph-ansible-keys
#iscsi_gw_group_name: iscsigws
#mgr_group_name: mgrs
#rgwloadbalancer_group_name: rgwloadbalancers
#grafana_server_group_name: grafana-server
#monitoring_group_name: monitoring
# If configure_firewall is true, then ansible will try to configure the
# appropriate firewalling rules so that Ceph daemons can communicate

View File

@ -33,7 +33,7 @@
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
- "{{ nfs_group_name|default('nfss') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
- "{{ monitoring_group_name|default('monitoring') }}"
become: true
gather_facts: false
vars:
@ -818,7 +818,7 @@
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: redeploy alertmanager/grafana/prometheus daemons
hosts: "{{ grafana_server_group_name|default('grafana-server') }}"
hosts: "{{ monitoring_group_name|default('monitoring') }}"
serial: 1
become: true
gather_facts: false
@ -961,7 +961,7 @@
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
- "{{ nfs_group_name|default('nfss') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
- "{{ monitoring_group_name|default('monitoring') }}"
become: true
gather_facts: false
tasks:
@ -1014,19 +1014,19 @@
when: dashboard_enabled | bool
block:
- name: update the placement of alertmanager hosts
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply alertmanager --placement='{{ groups.get(grafana_server_group_name, []) | length }} label:{{ grafana_server_group_name }}'"
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply alertmanager --placement='{{ groups.get(monitoring_group_name, []) | length }} label:{{ monitoring_group_name }}'"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of grafana hosts
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply grafana --placement='{{ groups.get(grafana_server_group_name, []) | length }} label:{{ grafana_server_group_name }}'"
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply grafana --placement='{{ groups.get(monitoring_group_name, []) | length }} label:{{ monitoring_group_name }}'"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of prometheus hosts
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply prometheus --placement='{{ groups.get(grafana_server_group_name, []) | length }} label:{{ grafana_server_group_name }}'"
command: "{{ cephadm_cmd }} shell --fsid {{ fsid }} -- ceph --cluster {{ cluster }} orch apply prometheus --placement='{{ groups.get(monitoring_group_name, []) | length }} label:{{ monitoring_group_name }}'"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'

View File

@ -9,7 +9,7 @@
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
- "{{ nfs_group_name|default('nfss') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
- "{{ monitoring_group_name|default('monitoring') }}"
become: true
gather_facts: false
vars:
@ -43,10 +43,10 @@
when: dashboard_enabled | bool
run_once: true
block:
- name: fail if [grafana-server] group doesn't exist or empty
- name: fail if [monitoring] group doesn't exist or empty
fail:
msg: "you must add a [grafana-server] group and add at least one node."
when: groups[grafana_server_group_name] is undefined or groups[grafana_server_group_name] | length == 0
msg: "you must add a [monitoring] group and add at least one node."
when: groups[monitoring_group_name] is undefined or groups[monitoring_group_name] | length == 0
- name: fail when dashboard_admin_password is not set
fail:
@ -197,7 +197,7 @@
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
- "{{ nfs_group_name|default('nfss') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
- "{{ monitoring_group_name|default('monitoring') }}"
become: true
gather_facts: false
tasks:
@ -285,7 +285,7 @@
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: adjust monitoring service placement
hosts: "{{ grafana_server_group_name|default('grafana-server') }}"
hosts: "{{ monitoring_group_name|default('monitoring') }}"
become: true
gather_facts: false
tasks:
@ -304,19 +304,19 @@
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of alertmanager hosts
command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply alertmanager --placement='label:{{ grafana_server_group_name }}'"
command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply alertmanager --placement='label:{{ monitoring_group_name }}'"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of grafana hosts
command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply grafana --placement='label:{{ grafana_server_group_name }}'"
command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply grafana --placement='label:{{ monitoring_group_name }}'"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'
- name: update the placement of prometheus hosts
command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply prometheus --placement='label:{{ grafana_server_group_name }}'"
command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch apply prometheus --placement='label:{{ monitoring_group_name }}'"
changed_when: false
environment:
CEPHADM_IMAGE: '{{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}'

View File

@ -8,7 +8,7 @@
- clients
- iscsigws
- mgrs
- grafana-server
- monitoring
gather_facts: false
become: True
@ -54,7 +54,7 @@
- "{{ mgr_group_name | default('mgrs') }}"
- "{{ iscsi_gw_group_name | default('iscsigws') }}"
- "{{ rbdmirror_group_name | default('rbdmirrors') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
- "{{ monitoring_group_name | default('monitoring') }}"
gather_facts: false
become: true
tasks:
@ -117,7 +117,7 @@
- "{{ prometheus_container_image }}"
when:
- dashboard_enabled | bool
- inventory_hostname in groups.get(grafana_server_group_name, [])
- inventory_hostname in groups.get(monitoring_group_name, [])
- name: "pulling {{ node_exporter_container_image }} image from docker daemon"
command: "{{ timeout_command }} {{ container_binary }} pull docker-daemon:{{ node_exporter_container_image }}"
@ -193,17 +193,17 @@
- import_role:
name: ceph-facts
tasks_from: grafana.yml
when: inventory_hostname in groups.get(grafana_server_group_name, [])
when: inventory_hostname in groups.get(monitoring_group_name, [])
- import_role:
name: ceph-grafana
tasks_from: systemd.yml
when: inventory_hostname in groups.get(grafana_server_group_name, [])
when: inventory_hostname in groups.get(monitoring_group_name, [])
- import_role:
name: ceph-prometheus
tasks_from: systemd.yml
when: inventory_hostname in groups.get(grafana_server_group_name, [])
when: inventory_hostname in groups.get(monitoring_group_name, [])
- name: reload systemd daemon
systemd:

View File

@ -42,7 +42,7 @@
- "{{ nfs_group_name|default('nfss') }}"
- "{{ client_group_name|default('clients') }}"
- "{{ mgr_group_name|default('mgrs') }}"
- grafana-server
- "{{ monitoring_group_name | default('monitoring') }}"
become: true
@ -137,7 +137,7 @@
- "{{ nfs_group_name|default('nfss') }}"
- "{{ client_group_name|default('clients') }}"
- "{{ mgr_group_name|default('mgrs') }}"
- grafana-server
- "{{ monitoring_group_name|default('monitoring') }}"
- clients
- iscsigws
@ -172,8 +172,8 @@
when: dashboard_enabled | bool
- name: purge ceph grafana-server
hosts: grafana-server
- name: purge ceph monitoring
hosts: monitoring
become: true
vars:
grafana_services:
@ -690,7 +690,7 @@
- "{{ nfs_group_name|default('nfss') }}"
- "{{ client_group_name|default('clients') }}"
- "{{ mgr_group_name|default('mgrs') }}"
- grafana-server
- "{{ monitoring_group_name|default('monitoring') }}"
gather_facts: false # Already gathered previously

View File

@ -369,7 +369,7 @@
- "{{ rbdmirror_group_name|default('rbdmirrors') }}"
- "{{ nfs_group_name|default('nfss') }}"
- "{{ mgr_group_name|default('mgrs') }}"
- grafana-server
- "{{ monitoring_group_name | default('monitoring') }}"
- iscsigws
- clients
@ -407,7 +407,7 @@
- name: purge ceph-grafana
hosts: grafana-server
hosts: monitoring
gather_facts: false

View File

@ -49,7 +49,7 @@
- "{{ nfs_group_name|default('nfss') }}"
- "{{ client_group_name|default('clients') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ grafana_server_group_name|default('grafana-server') }}"
- "{{ monitoring_group_name|default('monitoring') }}"
any_errors_fatal: True
become: True
@ -898,7 +898,7 @@
name: ceph-node-exporter
- name: upgrade monitoring node
hosts: "{{ grafana_server_group_name }}"
hosts: "{{ monitoring_group_name }}"
gather_facts: false
become: true
tasks:

View File

@ -26,7 +26,7 @@
- name: get a list of node where the keyring should be copied
set_fact:
list_target_node: "{{ list_target_node | default([]) | union(((groups.get('all') | difference(groups.get(grafana_server_group_name, []) + groups.get(client_group_name, []) + groups.get(nfs_group_name, []) + groups.get(iscsi_gw_group_name, []))) + groups.get(item, [])) | unique) }}"
list_target_node: "{{ list_target_node | default([]) | union(((groups.get('all') | difference(groups.get(monitoring_group_name, []) + groups.get(client_group_name, []) + groups.get(nfs_group_name, []) + groups.get(iscsi_gw_group_name, []))) + groups.get(item, [])) | unique) }}"
run_once: True
with_items:
- "{{ mon_group_name if groups.get(mon_group_name, []) | length > 0 else [] }}"

View File

@ -49,7 +49,7 @@ client_group_name: clients
iscsi_gw_group_name: iscsigws
mgr_group_name: mgrs
rgwloadbalancer_group_name: rgwloadbalancers
grafana_server_group_name: grafana-server
monitoring_group_name: monitoring
# If configure_firewall is true, then ansible will try to configure the
# appropriate firewalling rules so that Ceph daemons can communicate

View File

@ -1 +1 @@
---
---

View File

@ -0,0 +1,16 @@
---
- name: convert grafana-server group name if exist
add_host:
name: "{{ item }}"
groups: "monitoring"
ansible_host: "{{ hostvars[item]['ansible_host'] | default(omit) }}"
ansible_port: "{{ hostvars[item]['ansible_port'] | default(omit) }}"
delegate_to: localhost
with_items: "{{ groups.get(grafana_server_group_name, []) }}"
when: groups.get(grafana_server_group_name, []) | length > 0
run_once: True
- name: set_fact monitoring_group_name
set_fact:
monitoring_group_name: "{{ grafana_server_group_name | default(monitoring_group_name) }}"
run_once: True

View File

@ -2,34 +2,34 @@
set_fact:
grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first }}"
when:
- groups.get(grafana_server_group_name, []) | length > 0
- groups.get(monitoring_group_name, []) | length > 0
- ip_version == 'ipv4'
- dashboard_enabled | bool
- inventory_hostname in groups[grafana_server_group_name]
- inventory_hostname in groups[monitoring_group_name]
- name: set grafana_server_addr fact - ipv6
set_fact:
grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap }}"
when:
- groups.get(grafana_server_group_name, []) | length > 0
- groups.get(monitoring_group_name, []) | length > 0
- ip_version == 'ipv6'
- dashboard_enabled | bool
- inventory_hostname in groups[grafana_server_group_name]
- inventory_hostname in groups[monitoring_group_name]
- name: set grafana_server_addrs fact - ipv4
set_fact:
grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | first]) | unique }}"
with_items: "{{ groups.get(grafana_server_group_name, []) }}"
with_items: "{{ groups.get(monitoring_group_name, []) }}"
when:
- groups.get(grafana_server_group_name, []) | length > 0
- groups.get(monitoring_group_name, []) | length > 0
- ip_version == 'ipv4'
- dashboard_enabled | bool
- name: set grafana_server_addrs fact - ipv6
set_fact:
grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ipwrap]) | unique }}"
with_items: "{{ groups.get(grafana_server_group_name, []) }}"
with_items: "{{ groups.get(monitoring_group_name, []) }}"
when:
- groups.get(grafana_server_group_name, []) | length > 0
- groups.get(monitoring_group_name, []) | length > 0
- ip_version == 'ipv6'
- dashboard_enabled | bool

View File

@ -1,3 +1,7 @@
---
- name: include_tasks convert_grafana_server_group_name.yml
include_tasks: convert_grafana_server_group_name.yml
when: grafana_server_group_name is defined
- name: include facts.yml
include_tasks: facts.yml

View File

@ -64,5 +64,5 @@
- "tcp"
- "udp"
when:
- grafana_server_group_name is defined
- grafana_server_group_name in group_names
- monitoring_group_name is defined
- monitoring_group_name in group_names

View File

@ -19,14 +19,14 @@ scrape_configs:
{% endfor %}
- job_name: 'node'
static_configs:
{% for host in (groups['all'] | difference(groups[grafana_server_group_name]|union(groups.get(client_group_name, [])))) %}
{% for host in (groups['all'] | difference(groups[monitoring_group_name] | union(groups.get(client_group_name, [])))) %}
- targets: ['{{ host }}:{{ node_exporter_port }}']
labels:
instance: "{{ hostvars[host]['ansible_nodename'] }}"
{% endfor %}
- job_name: 'grafana'
static_configs:
{% for host in groups[grafana_server_group_name] %}
{% for host in groups[monitoring_group_name] %}
- targets: ['{{ host }}:{{ node_exporter_port }}']
labels:
instance: "{{ hostvars[host]['ansible_nodename'] }}"

View File

@ -212,15 +212,15 @@
- ceph_rbd_mirror_configure | default(false) | bool
- block:
- name: fail if [grafana-server] group doesn't exist
- name: fail if monitoring group doesn't exist
fail:
msg: "you must add a [grafana-server] group and add at least one node."
when: groups[grafana_server_group_name] is undefined
msg: "you must add a monitoring group and add at least one node."
when: groups[monitoring_group_name] is undefined
- name: fail when [grafana-server] doesn't contain at least one node.
- name: fail when monitoring doesn't contain at least one node.
fail:
msg: "you must add at least one node in the [grafana-server] hosts group"
when: groups[grafana_server_group_name] | length < 1
msg: "you must add at least one node in the monitoring hosts group"
when: groups[monitoring_group_name] | length < 1
- name: fail when dashboard_admin_password and/or grafana_admin_password are not set
fail:

View File

@ -11,7 +11,7 @@
- clients
- iscsigws
- mgrs
- grafana-server
- monitoring
gather_facts: false
become: True
@ -423,7 +423,7 @@
- import_playbook: dashboard.yml
when:
- dashboard_enabled | bool
- groups.get(grafana_server_group_name, []) | length > 0
- groups.get(monitoring_group_name, []) | length > 0
- hosts:
- mons

View File

@ -11,7 +11,7 @@
- clients
- mgrs
- iscsigws
- grafana-server
- monitoring
- rgwloadbalancers
gather_facts: false
@ -444,7 +444,7 @@
- import_playbook: dashboard.yml
when:
- dashboard_enabled | bool
- groups.get(grafana_server_group_name, []) | length > 0
- groups.get(monitoring_group_name, []) | length > 0
- hosts:
- mons

View File

@ -127,7 +127,7 @@ def node(host, request):
request.function, group_names)
pytest.skip(reason)
if request.node.get_closest_marker('ceph_crash') and group_names in [['nfss'], ['iscsigws'], ['clients'], ['grafana-server']]:
if request.node.get_closest_marker('ceph_crash') and group_names in [['nfss'], ['iscsigws'], ['clients'], ['monitoring']]:
pytest.skip('Not a valid test for nfs, client or iscsigw nodes')
if request.node.get_closest_marker("no_docker") and docker:

View File

@ -32,5 +32,5 @@ rbd-mirror0
[iscsigws]
iscsi-gw0
[grafana-server]
[monitoring]
mon0

View File

@ -40,3 +40,4 @@ node_exporter_container_image: "quay.io/prometheus/node-exporter:v0.17.0"
prometheus_container_image: "quay.io/prometheus/prometheus:v2.7.2"
alertmanager_container_image: "quay.io/prometheus/alertmanager:v0.16.2"
grafana_container_image: "quay.io/app-sre/grafana:5.4.3"
grafana_server_group_name: ceph_monitoring

View File

@ -32,5 +32,5 @@ rbd-mirror0
[iscsigws]
iscsi-gw0
[grafana-server]
[ceph_monitoring]
mon0

View File

@ -23,5 +23,5 @@ rgw0
[clients]
client0
[grafana-server]
[monitoring]
mon0

View File

@ -27,5 +27,5 @@ rbd-mirror0
[iscsigws]
iscsi-gw0
[grafana-server]
[monitoring]
mon0

View File

@ -22,5 +22,5 @@ mds0
#rgw0
#mds0
[grafana-server]
[monitoring]
mon0

View File

@ -22,5 +22,5 @@ mds0
#rgw0
#mds0
[grafana-server]
[monitoring]
mon0

View File

@ -7,5 +7,5 @@ osd0
[mgrs]
mon0
[grafana-server]
[monitoring]
mon0

View File

@ -26,7 +26,7 @@ rbd-mirror0
[iscsigws]
iscsi-gw0
[grafana-server]
[monitoring]
mon0
#[all:vars]