You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If i would like to import dashboard without changes i have to set overwrite on true , and its problem because i still change dashboards, is it possible to set only status --> present and then overwrite only if dashboard has been changed.
overwrite boolean | Choices:no ←yes | Override existing dashboard when state is present.
Datasource , if i upload datasource to main org. and datasource exist nothing change (its correct) when i create second org.
1.Main Org
2.Public Org --> if i run playbook on public org datasources are changed (its idempotent problem)
The text was updated successfully, but these errors were encountered:
adamsipo
changed the title
Problem with idempotent playbook , overide and datasources
Problem with idempotent playbook , overwrite and datasources
Nov 24, 2021
Hi guys
If i would like to import dashboard without changes i have to set overwrite on true , and its problem because i still change dashboards, is it possible to set only status --> present and then overwrite only if dashboard has been changed.
overwrite boolean | Choices:no ←yes | Override existing dashboard when state is present.
Datasource , if i upload datasource to main org. and datasource exist nothing change (its correct) when i create second org.
1.Main Org
2.Public Org --> if i run playbook on public org datasources are changed (its idempotent problem)
Create datasource:
loop_control:
label: "PRIVATE ==> Environment: {{ item.name }} ==> Cluster: {{ item.cluster }} URL: {{ item.url }} , APPLICATION: URL: {{ url }}"
community.grafana.grafana_datasource:
state: present
grafana_url: "{{ url }}"
grafana_api_key: "{{ api_key_private }}"
name: "{{ item.name }}"
ds_type: prometheus
ds_url: {{ url }}.{{ item.cluster }}.{{ item.url }}
access: proxy
tls_skip_verify: true
additional_json_data:
httpHeaderName1: "Authorization"
additional_secure_json_data:
httpHeaderValue1: "Bearer {{ item.token }}"
with_items:
Create dashboards:
community.grafana.grafana_dashboard:
grafana_url: "{{ url }}"
grafana_api_key: "{{ api_key_private }}"
state: present
folder: "{{ item.0.name }}"
commit_message: Updated by ansible
overwrite: true
path: "/tmp/{{ item.1 }}"
loop_control:
label: "PRIVATE_GRAFANA_PART ==> URL: {{ url }} DASHBOARDS: {{ item.1 }} ==> INTO FOLDER: {{ item.0.name }}"
loop: "{{ grafana_envportal.folders | subelements('dashboards') }}"
Output:
TASK [grafana_deploy : Create prometheus private datasource] ******************************************************************************************************************************************************
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
!!!CHANGED!!! but datasources exist!
TASK [grafana_deploy : Create prometheus public datasource] *******************************************************************************************************************************************************
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
TASK [grafana_deploy : Create private alertmanager datasource] ****************************************************************************************************************************************************
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
ok: [localhost] => (item=PRIVATE
!!!CHANGED!!! but datasources exist!
TASK [grafana_deploy : Create public alertmanager datasource] *****************************************************************************************************************************************************
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
changed: [localhost] => (item=PUBLIC
!!!CHANGED!!!
TASK [grafana_deploy : Import Grafana private dashboards] *********************************************************************************************************************************************************
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
changed: [localhost] => (item=PRIVATE_GRAFANA_PART
TASK [grafana_deploy : Import Grafana public dashboards] **********************************************************************************************************************************************************
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
changed: [localhost] => (item=PUBLIC_GRAFANA_PART
Thanks for your answer. :)
The text was updated successfully, but these errors were encountered: