Commit eefe11d9 authored by Guillaume Abrioux's avatar Guillaume Abrioux
Browse files

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: default avatarGuillaume Abrioux <gabrioux@redhat.com>
parent 90257536
......@@ -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 = {
......
......@@ -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:
......
......@@ -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
......
......@@ -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
......
......@@ -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 }}'
......
......@@ -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 }}'
......
......@@ -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:
......
......@@ -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
......
......@@ -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
......
......@@ -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:
......
......@@ -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 [] }}"
......
......@@ -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
......
---
- 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
......@@ -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
---
- 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
......@@ -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
......@@ -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'] }}"
......
......@@ -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:
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment