kolla-ansible/ansible/roles/grafana/handlers/main.yml
Will Szumski 31f97d6cca Do not wait for grafana to start when kolla_action=config
Prior to this change it was not possible to generate the config
before deploying the services as you'd hit:

RUNNING HANDLER [Waiting for grafana to start on first node] *************************
Monday 18 January 2021  15:06:35 +0000 (0:00:00.182)       0:04:39.213 ********
skipping: [sv-h22a8-u19]
skipping: [sv-h22a5-u36]
FAILED - RETRYING: Waiting for grafana to start on first node (10 retries left).

This would never succeed as the service has not yet been deployed.

TrivialFix
Change-Id: I9437a049b24e5e613a7e66add481a8983b84867a
2021-01-18 15:42:31 +00:00

54 lines
1.6 KiB
YAML

---
- name: Restart first grafana container
listen: Restart grafana container
vars:
service_name: "grafana"
service: "{{ grafana_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname == groups[service.group]|first
- name: Waiting for grafana to start on first node
listen: Restart grafana container
vars:
service_name: "grafana"
service: "{{ grafana_services[service_name] }}"
become: true
kolla_toolbox:
module_name: uri
module_args:
url: "http://{{ api_interface_address | put_address_in_context('url') }}:{{ grafana_server_port }}/login"
status_code: 200
register: result
until: result.get('status') == 200
retries: 10
delay: 2
when:
- kolla_action != "config"
- inventory_hostname == groups[service.group]|first
- name: Restart remaining grafana containers
listen: Restart grafana container
vars:
service_name: "grafana"
service: "{{ grafana_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname != groups[service.group]|first