From 181925016cd753ea82899b6f302fd0baf18bdc90 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 16:14:08 +0500 Subject: [PATCH 01/18] fixing modify alertmanager yaml --- .../tasks/grafana_oncall_hub_spoke.yml | 1 + .../tasks/grafana_oncall_standalone.yml | 1 + .../tasks/modify_alertmanager_secret.yml | 12 ++++++++---- vocabulary | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml index a4a9d033..799c7d89 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml @@ -113,6 +113,7 @@ receiver_url: "{{ item.grafana_details.link }}" namespace: "{{ item.cluster.namespace }}" cluster_name: "{{ item.cluster.name }}" + provisionMode: "hubAndSpoke" loop: "{{ mapped_integrations }}" - name: Update CR status for SyncSet creation diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml index c4c2243a..43d7f1d9 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml @@ -83,6 +83,7 @@ vars: receiver_name: "{{ cluster_name }}" receiver_url: "{{ grafana_integration_response.json.link }}" + provisionMode: "standalone" - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index aed78c55..45fd8aa5 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -23,6 +23,10 @@ } }, recursive=True) }} +- name: Print Provision Mode + debug: + msg: "Ansible Version: {{ provisionMode }}" + - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: state: present @@ -37,12 +41,12 @@ phase: "Processing" reason: "AlertmanagerConfigModified" message: "Decoded and modified the alertmanager secret configuration" - +#should not run with standalone - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: gco_cr.spec.provisionMode == 'hubAndSpoke' - + when: {{ provisionMode }} == 'hubAndSpoke' +#should not run with standalone - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: state: present @@ -67,5 +71,5 @@ alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" when: - create_integration_for | length > 0 - - gco_cr.spec.provisionMode == 'hubAndSpoke' + - {{ provisionMode }} == 'hubAndSpoke' register: syncset_creation_results diff --git a/vocabulary b/vocabulary index 4fb42902..107a7ad2 160000 --- a/vocabulary +++ b/vocabulary @@ -1 +1 @@ -Subproject commit 4fb4290235638237f2c987937f943d18ffb0641b +Subproject commit 107a7ad2b7d22887052e6e657c2440f8522ab4d6 From ce9fbc7348d8107d1c02ed68c4f4256064d4c512 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 16:19:44 +0500 Subject: [PATCH 02/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 45fd8aa5..d017670a 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -41,12 +41,12 @@ phase: "Processing" reason: "AlertmanagerConfigModified" message: "Decoded and modified the alertmanager secret configuration" -#should not run with standalone + - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" when: {{ provisionMode }} == 'hubAndSpoke' -#should not run with standalone + - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: state: present From b913f6b8ca7b2987bc71bac2de2b1cfe330292d0 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 16:21:57 +0500 Subject: [PATCH 03/18] fixing lint errors --- .../grafana_cloud_operator/tasks/modify_alertmanager_secret.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index d017670a..04a715d7 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -45,7 +45,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: {{ provisionMode }} == 'hubAndSpoke' + when: "{{ provisionMode }}" == 'hubAndSpoke' - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: From e84711952d3961724c4352d5fe9edea5d21b9b13 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 16:24:56 +0500 Subject: [PATCH 04/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 04a715d7..bc9586b2 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -45,7 +45,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: "{{ provisionMode }}" == 'hubAndSpoke' + when: provisionMode == 'hubAndSpoke' - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: @@ -71,5 +71,5 @@ alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" when: - create_integration_for | length > 0 - - {{ provisionMode }} == 'hubAndSpoke' + - provisionMode == 'hubAndSpoke' register: syncset_creation_results From 1ba58611d5372dfd0dfd0474615e550c779bb85e Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 16:28:34 +0500 Subject: [PATCH 05/18] fixing lint errors --- .../tasks/grafana_oncall_hub_spoke.yml | 2 +- .../tasks/grafana_oncall_standalone.yml | 2 +- .../tasks/modify_alertmanager_secret.yml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml index 799c7d89..f488c47d 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml @@ -113,7 +113,7 @@ receiver_url: "{{ item.grafana_details.link }}" namespace: "{{ item.cluster.namespace }}" cluster_name: "{{ item.cluster.name }}" - provisionMode: "hubAndSpoke" + provision_mode: "hubAndSpoke" loop: "{{ mapped_integrations }}" - name: Update CR status for SyncSet creation diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml index 43d7f1d9..ffac55fc 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml @@ -83,7 +83,7 @@ vars: receiver_name: "{{ cluster_name }}" receiver_url: "{{ grafana_integration_response.json.link }}" - provisionMode: "standalone" + provision_mode: "standalone" - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index bc9586b2..caa584da 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -25,7 +25,7 @@ - name: Print Provision Mode debug: - msg: "Ansible Version: {{ provisionMode }}" + msg: "Ansible Version: {{ provision_mode }}" - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: @@ -45,7 +45,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: provisionMode == 'hubAndSpoke' + when: provision_mode == 'hubAndSpoke' - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: @@ -71,5 +71,5 @@ alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" when: - create_integration_for | length > 0 - - provisionMode == 'hubAndSpoke' + - provision_mode == 'hubAndSpoke' register: syncset_creation_results From b1c315fb837215155561526d59b786c77284356d Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 16:31:14 +0500 Subject: [PATCH 06/18] fixing lint errors --- .../grafana_cloud_operator/tasks/modify_alertmanager_secret.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index caa584da..36ebf0c7 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -24,7 +24,7 @@ }, recursive=True) }} - name: Print Provision Mode - debug: + ansible.builtin.debug: msg: "Ansible Version: {{ provision_mode }}" - name: Update CR status to AlertmanagerConfigModified From a16debb9bc77518ecbb51716e16a0d827faaf4d7 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 16:52:48 +0500 Subject: [PATCH 07/18] fixing lint errors --- .../grafana_cloud_operator/tasks/modify_alertmanager_secret.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 36ebf0c7..edfcd01d 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -25,7 +25,7 @@ - name: Print Provision Mode ansible.builtin.debug: - msg: "Ansible Version: {{ provision_mode }}" + msg: "Ansible Version: provision_mode" - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: From 04e8315ae2b777679f401873543de66895f0d664 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 17:15:30 +0500 Subject: [PATCH 08/18] fixing lint errors --- .../grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml | 4 ++++ .../tasks/grafana_oncall_standalone.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml index f488c47d..a12e501d 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml @@ -115,6 +115,10 @@ cluster_name: "{{ item.cluster.name }}" provision_mode: "hubAndSpoke" loop: "{{ mapped_integrations }}" + task_include: + file: modify_alertmanager_secret.yml + vars: + provision_mode: "{{ provision_mode }}" - name: Update CR status for SyncSet creation kubernetes.core.k8s: diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml index ffac55fc..5adbaf9e 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml @@ -84,6 +84,10 @@ receiver_name: "{{ cluster_name }}" receiver_url: "{{ grafana_integration_response.json.link }}" provision_mode: "standalone" + task_include: + file: modify_alertmanager_secret.yml + vars: + provision_mode: "{{ provision_mode }}" - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: From e0ec80e2d28365b7dee7091254a07df761c898c8 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 17:48:43 +0500 Subject: [PATCH 09/18] Revert "fixing lint errors" This reverts commit 04e8315ae2b777679f401873543de66895f0d664. --- .../grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml | 4 ---- .../tasks/grafana_oncall_standalone.yml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml index a12e501d..f488c47d 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_hub_spoke.yml @@ -115,10 +115,6 @@ cluster_name: "{{ item.cluster.name }}" provision_mode: "hubAndSpoke" loop: "{{ mapped_integrations }}" - task_include: - file: modify_alertmanager_secret.yml - vars: - provision_mode: "{{ provision_mode }}" - name: Update CR status for SyncSet creation kubernetes.core.k8s: diff --git a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml index 5adbaf9e..ffac55fc 100644 --- a/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml +++ b/roles/grafana_cloud_operator/tasks/grafana_oncall_standalone.yml @@ -84,10 +84,6 @@ receiver_name: "{{ cluster_name }}" receiver_url: "{{ grafana_integration_response.json.link }}" provision_mode: "standalone" - task_include: - file: modify_alertmanager_secret.yml - vars: - provision_mode: "{{ provision_mode }}" - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: From d5227327b29eac9be3c781a91e191c7a63575c5d Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:23:20 +0500 Subject: [PATCH 10/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index edfcd01d..2fb20148 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -25,7 +25,7 @@ - name: Print Provision Mode ansible.builtin.debug: - msg: "Ansible Version: provision_mode" + msg: "Ansible Version: {{ provision_mode }}" - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: @@ -45,7 +45,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: provision_mode == 'hubAndSpoke' + when: provision_mode == "hubAndSpoke" - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: @@ -70,6 +70,5 @@ data: alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" when: - - create_integration_for | length > 0 - - provision_mode == 'hubAndSpoke' + - create_integration_for | length > 0 and provision_mode == "hubAndSpoke" register: syncset_creation_results From 6b06fe4f77b5984ceec405fa722311b667d0ef07 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:29:46 +0500 Subject: [PATCH 11/18] fixing lint errors --- .../grafana_cloud_operator/tasks/modify_alertmanager_secret.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 2fb20148..1929e2b8 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -45,7 +45,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: provision_mode == "hubAndSpoke" + when: {{ provision_mode }} == "hubAndSpoke" - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: From b4f362e2914a645e91b0c359a1a24dd0f6a69f69 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:32:33 +0500 Subject: [PATCH 12/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 1929e2b8..089a5d51 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -45,7 +45,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: {{ provision_mode }} == "hubAndSpoke" + when: "{{ provision_mode }}" == "hubAndSpoke" - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: @@ -70,5 +70,5 @@ data: alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" when: - - create_integration_for | length > 0 and provision_mode == "hubAndSpoke" + - create_integration_for | length > 0 and "{{ provision_mode }}" == "hubAndSpoke" register: syncset_creation_results From 4d74811892687b004d815eff739b1212df0bf4b3 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:36:43 +0500 Subject: [PATCH 13/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 089a5d51..b261580c 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -25,7 +25,8 @@ - name: Print Provision Mode ansible.builtin.debug: - msg: "Ansible Version: {{ provision_mode }}" + msg: " echo {{ provision_mode }}" + register: provision_mode - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: @@ -45,7 +46,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: "{{ provision_mode }}" == "hubAndSpoke" + when: provision_mode == "hubAndSpoke" - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: @@ -70,5 +71,5 @@ data: alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" when: - - create_integration_for | length > 0 and "{{ provision_mode }}" == "hubAndSpoke" + - create_integration_for | length > 0 and provision_mode == "hubAndSpoke" register: syncset_creation_results From c556bae518c1e3012d46c3bfa4b74c5fb062c3c9 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:37:57 +0500 Subject: [PATCH 14/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index b261580c..f574857c 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -25,8 +25,8 @@ - name: Print Provision Mode ansible.builtin.debug: - msg: " echo {{ provision_mode }}" - register: provision_mode + msg: "{{ provision_mode }}" + register: provision_mode - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: From 46f043a869e44cbd90bbfc4d9bab610939f2d250 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:43:53 +0500 Subject: [PATCH 15/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index f574857c..0be4af8b 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -25,8 +25,7 @@ - name: Print Provision Mode ansible.builtin.debug: - msg: "{{ provision_mode }}" - register: provision_mode + msg: "Ansible Version: {{ provision_mode }}" - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: @@ -46,7 +45,7 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: provision_mode == "hubAndSpoke" + when: $provision_mode == "hubAndSpoke" - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: @@ -71,5 +70,5 @@ data: alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" when: - - create_integration_for | length > 0 and provision_mode == "hubAndSpoke" + - create_integration_for | length > 0 register: syncset_creation_results From cbbc13bdbc322848980d2e455f0ba6df2ef334d3 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:50:53 +0500 Subject: [PATCH 16/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 0be4af8b..4a28b6a5 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -45,7 +45,9 @@ - name: Re-encode modified alertmanager content for cluster ansible.builtin.set_fact: encoded_alertmanager_secret_content: "{{ modified_alertmanager_secret_content | to_nice_yaml | b64encode }}" - when: $provision_mode == "hubAndSpoke" + vars: + provision_mode_check: "{{ provision_mode }}" + when: provision_mode_check == "hubAndSpoke" - name: Create a new SyncSet for each cluster to patch alertmanager-main secret kubernetes.core.k8s: From 9cee87305bdff4098d2807cc1b85c08ce1f1ede4 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Thu, 18 Jan 2024 18:56:39 +0500 Subject: [PATCH 17/18] fixing lint errors --- .../tasks/modify_alertmanager_secret.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 4a28b6a5..11b87bcc 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -71,6 +71,9 @@ patch: | data: alertmanager.yaml: "{{ encoded_alertmanager_secret_content }}" + vars: + provision_mode_check: "{{ provision_mode }}" when: + - provision_mode_check == "hubAndSpoke" - create_integration_for | length > 0 register: syncset_creation_results From 53056102adae684700883688aaaab33daa150db0 Mon Sep 17 00:00:00 2001 From: tehreemnisa Date: Fri, 19 Jan 2024 10:15:10 +0500 Subject: [PATCH 18/18] removing debug mssg --- .../tasks/modify_alertmanager_secret.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml index 11b87bcc..1c8f3e41 100644 --- a/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml +++ b/roles/grafana_cloud_operator/tasks/modify_alertmanager_secret.yml @@ -23,10 +23,6 @@ } }, recursive=True) }} -- name: Print Provision Mode - ansible.builtin.debug: - msg: "Ansible Version: {{ provision_mode }}" - - name: Update CR status to AlertmanagerConfigModified kubernetes.core.k8s: state: present