Ivan Halomi 4ca2d41762 Adding container_engine to kolla_toolbox module
Second part of patchset:
https://review.opendev.org/c/openstack/kolla-ansible/+/799229/
in which was suggested to split patch into smaller ones.

THis change adds container_engine to module parameters
so when we introduce podman, kolla_toolbox can be used
for both engines.

Signed-off-by: Ivan Halomi <i.halomi@partner.samsung.com>
Co-authored-by: Martin Hiner <m.hiner@partner.samsung.com>
Change-Id: Ic2093aa9341a0cb36df8f340cf290d62437504ad
2022-11-04 15:32:30 +01:00

54 lines
1.6 KiB
YAML

---
- name: Wait for grafana application ready
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ grafana_internal_endpoint }}/login"
status_code: 200
register: result
until: result.get('status') == 200
retries: 30
delay: 2
run_once: true
- name: Enable grafana datasources
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ grafana_internal_endpoint }}/api/datasources"
method: POST
user: "{{ grafana_admin_username }}"
password: "{{ grafana_admin_password }}"
body: "{{ item.value.data | to_json }}"
body_format: json
force_basic_auth: yes
status_code: 200, 409
register: response
run_once: True
changed_when: response.status == 200
failed_when: response.status not in [200, 409] or
response.status == 409 and ("name already exists" not in response.json.message | default(""))
with_dict: "{{ grafana_data_sources }}"
when: item.value.enabled | bool
- name: Disable Getting Started panel
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: uri
module_args:
url: "{{ grafana_internal_endpoint }}/api/user/helpflags/1"
method: PUT
user: "{{ grafana_admin_username }}"
password: "{{ grafana_admin_password }}"
force_basic_auth: yes
status_code: 200
register: grafana_response
changed_when: grafana_response.status == 200
run_once: true
when: grafana_custom_dashboard_file.stat.exists