From c5d1e1d5f2f4f9adfb7736022888a27437e4d969 Mon Sep 17 00:00:00 2001 From: Bartosz Zurkowski Date: Sun, 16 Dec 2018 16:23:51 +0100 Subject: [PATCH] Call Grafana APIs only once In multinode deployments creating default Grafana organization failed, because Ansible attempted to call Grafana API in the context of each host in the inventory. After creating organization via the first host, subsequent attempts via the remaining hosts failed due to already existing organization. This change enforces creating default organization only once. Other tasks using Grafana API have been enforced to be ran only once as well. Change-Id: I3a93a719b3c9b4e55ab226d3b22d571d9a0f489d Signed-off-by: Bartosz Zurkowski --- ansible/roles/monasca/tasks/post_config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansible/roles/monasca/tasks/post_config.yml b/ansible/roles/monasca/tasks/post_config.yml index 6d9f0ff066..45d64f9504 100644 --- a/ansible/roles/monasca/tasks/post_config.yml +++ b/ansible/roles/monasca/tasks/post_config.yml @@ -21,6 +21,7 @@ password: '{{ monasca_grafana_admin_password }}' return_content: true force_basic_auth: true + run_once: True register: monasca_grafana_orgs - name: Create default control plane organisation if it doesn't exist @@ -33,6 +34,7 @@ body: name: '{{ monasca_grafana_control_plane_org }}' force_basic_auth: true + run_once: True when: monasca_grafana_control_plane_org not in monasca_grafana_orgs.json|map(attribute='name')|unique - name: Lookup Monasca Grafana control plane organisation ID @@ -43,6 +45,7 @@ password: '{{ monasca_grafana_admin_password }}' return_content: true force_basic_auth: true + run_once: True register: monasca_grafana_conf_org - name: Add {{ monasca_grafana_admin_username }} user to control plane organisation @@ -70,6 +73,7 @@ user: '{{ monasca_grafana_admin_username }}' password: '{{ monasca_grafana_admin_password }}' force_basic_auth: true + run_once: True - name: Enable Monasca Grafana datasource for control plane organisation uri: