dashboard: use dedicated group only

There's no need to add complexity and trying to fallback on other group.
Let's deploy dashboard on all nodes present in grafana-server group.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/4285/head
Guillaume Abrioux 2019-07-25 19:08:22 +02:00
parent 43135840b1
commit d67230b2a2
6 changed files with 9 additions and 10 deletions

View File

@ -704,6 +704,7 @@ dummy:
# Choose http or https # Choose http or https
# For https, you should set dashboard.crt/key and grafana.crt/key # For https, you should set dashboard.crt/key and grafana.crt/key
#dashboard_protocol: http #dashboard_protocol: http
#dashboard_url: "{{ ansible_hostname }}"
#dashboard_port: 8443 #dashboard_port: 8443
#dashboard_admin_user: admin #dashboard_admin_user: admin
#dashboard_admin_password: admin #dashboard_admin_password: admin

View File

@ -704,6 +704,7 @@ ceph_docker_registry: "registry.access.redhat.com"
# Choose http or https # Choose http or https
# For https, you should set dashboard.crt/key and grafana.crt/key # For https, you should set dashboard.crt/key and grafana.crt/key
#dashboard_protocol: http #dashboard_protocol: http
#dashboard_url: "{{ ansible_hostname }}"
#dashboard_port: 8443 #dashboard_port: 8443
#dashboard_admin_user: admin #dashboard_admin_user: admin
#dashboard_admin_password: admin #dashboard_admin_password: admin

View File

@ -32,7 +32,7 @@
status: "Complete" status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: '{{ groups["grafana-server"][0] | default(groups["mgrs"][0]) | default(groups["mons"][0]) | default(omit) }}' - hosts: "{{ grafana_server_group_name }}"
become: true become: true
pre_tasks: pre_tasks:
- name: set ceph grafana install 'In Progress' - name: set ceph grafana install 'In Progress'
@ -67,7 +67,7 @@
status: "Complete" status: "Complete"
end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}" end: "{{ lookup('pipe', 'date +%Y%m%d%H%M%SZ') }}"
- hosts: '{{ groups["mgrs"][0] | default(groups["mons"][0]) | default(omit) }}' - hosts: "{{ grafana_server_group_name }}"
become: true become: true
pre_tasks: pre_tasks:
- name: set ceph dashboard install 'In Progress' - name: set ceph dashboard install 'In Progress'

View File

@ -90,10 +90,6 @@
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
until: ac_result.rc == 0 until: ac_result.rc == 0
- name: set grafana url to grafana instance
set_fact:
dashboard_url: "{{ hostvars[(groups[grafana_server_group_name][0] | default(groups[mgr_group_name][0]) | default(groups[mon_group_name][0]))]['ansible_hostname'] }}"
- name: set grafana url - name: set grafana url
command: "{{ container_exec_cmd }} ceph dashboard set-grafana-api-url {{ dashboard_protocol }}://{{ dashboard_url }}:{{ grafana_port }}/" command: "{{ container_exec_cmd }} ceph dashboard set-grafana-api-url {{ dashboard_protocol }}://{{ dashboard_url }}:{{ grafana_port }}/"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"

View File

@ -696,6 +696,7 @@ dashboard_enabled: True
# Choose http or https # Choose http or https
# For https, you should set dashboard.crt/key and grafana.crt/key # For https, you should set dashboard.crt/key and grafana.crt/key
dashboard_protocol: http dashboard_protocol: http
dashboard_url: "{{ ansible_hostname }}"
dashboard_port: 8443 dashboard_port: 8443
dashboard_admin_user: admin dashboard_admin_user: admin
dashboard_admin_password: admin dashboard_admin_password: admin

View File

@ -305,17 +305,17 @@
- name: set grafana_server_addr fact - ipv4 - name: set grafana_server_addr fact - ipv4
set_fact: set_fact:
grafana_server_addr: "{{ (hostvars[groups[grafana_server_group_name][0] if groups.get(grafana_server_group_name, []) | length > 0 else groups[mgr_group_name][0]])['ansible_all_ipv4_addresses'] | ipaddr(public_network) | first }}" grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv4_addresses'] | ipaddr(public_network) | first }}"
when: when:
- (groups.get(grafana_server_group_name, []) | length > 0 or groups.get(mgr_group_name, []) | length > 0) - groups.get(grafana_server_group_name, []) | length > 0
- ip_version == 'ipv4' - ip_version == 'ipv4'
- dashboard_enabled | bool - dashboard_enabled | bool
- name: set grafana_server_addr fact - ipv6 - name: set grafana_server_addr fact - ipv6
set_fact: set_fact:
grafana_server_addr: "{{ (hostvars[groups[grafana_server_group_name][0] if groups.get(grafana_server_group_name, []) | length > 0 else groups[mgr_group_name][0]])['ansible_all_ipv6_addresses'] | ipaddr(public_network) | last | ipwrap }}" grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_all_ipv6_addresses'] | ipaddr(public_network) | last | ipwrap }}"
when: when:
- (groups.get(grafana_server_group_name, []) | length > 0 or groups.get(mgr_group_name, []) | length > 0) - groups.get(grafana_server_group_name, []) | length > 0
- ip_version == 'ipv6' - ip_version == 'ipv6'
- dashboard_enabled | bool - dashboard_enabled | bool