mirror of https://github.com/ceph/ceph-ansible.git
dashboard: add a last default value in grafana-server host section
If there is no mgrs and mons in the inventory, it will fail with the following error: ``` ERROR! The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'dict object' has no attribute 'mons' The error appears to be in '/home/guits/ceph-ansible/site-docker.yml.sample': line 539, column 3, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - hosts: '{{ (groups["mgrs"] | default(groups["mons"]))[0] }}' ^ here We could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value. For instance: with_items: - {{ foo }} Should be written as: with_items: - "{{ foo }}" ``` let's add an `omit` so it just display this message instead: ``` PLAY [[]] ******************* skipping: no hosts matched ``` Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>pull/4046/head
parent
6e2e30db54
commit
5457312e62
|
@ -558,7 +558,7 @@
|
||||||
name: ceph-grafana
|
name: ceph-grafana
|
||||||
when: dashboard_enabled
|
when: dashboard_enabled
|
||||||
|
|
||||||
- hosts: '{{ (groups["mgrs"] | default(groups["mons"]))[0] }}'
|
- hosts: '{{ (groups["grafana-server"] | default(groups["mgrs"]) | default(groups["mons"]))[0] | default(omit) }}'
|
||||||
become: true
|
become: true
|
||||||
tasks:
|
tasks:
|
||||||
- block:
|
- block:
|
||||||
|
|
|
@ -487,7 +487,7 @@
|
||||||
name: ceph-grafana
|
name: ceph-grafana
|
||||||
when: dashboard_enabled
|
when: dashboard_enabled
|
||||||
|
|
||||||
- hosts: '{{ (groups["mgrs"] | default(groups["mons"]))[0] }}'
|
- hosts: '{{ (groups["grafana-server"] | default(groups["mgrs"]) | default(groups["mons"]))[0] | default(omit) }}'
|
||||||
become: true
|
become: true
|
||||||
tasks:
|
tasks:
|
||||||
- import_role:
|
- import_role:
|
||||||
|
|
Loading…
Reference in New Issue