summaryrefslogtreecommitdiff
path: root/roles/kubernetes/standalone
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-11-26 20:40:28 +0100
committerChristian Pointner <equinox@spreadspace.org>2020-11-26 20:42:12 +0100
commit9a3f6e699892e66a9893cbd31adad0bfb5a3d9e9 (patch)
tree42354e599f1c2dda23c4d1ec344bbf531417de42 /roles/kubernetes/standalone
parentadd role for app keycloak (diff)
kubernetes/standalone: fix config hash annotation if role is included multiple times
Diffstat (limited to 'roles/kubernetes/standalone')
-rw-r--r--roles/kubernetes/standalone/pod/tasks/main.yml19
1 files changed, 13 insertions, 6 deletions
diff --git a/roles/kubernetes/standalone/pod/tasks/main.yml b/roles/kubernetes/standalone/pod/tasks/main.yml
index b0644dfd..9ac6b497 100644
--- a/roles/kubernetes/standalone/pod/tasks/main.yml
+++ b/roles/kubernetes/standalone/pod/tasks/main.yml
@@ -44,11 +44,18 @@
set_fact:
config_hash_value: "{{ config_hash_file_stat.stat.checksum }}"
-- name: remove config-hash file
+- name: make sure to unset config-hash value
when: "'config_hash_items' not in kubernetes_standalone_pod"
- file:
- path: "/etc/kubernetes/config-hashes/{{ kubernetes_standalone_pod.name }}.yml"
- state: absent
+ block:
+ - name: remove config-hash file
+ file:
+ path: "/etc/kubernetes/config-hashes/{{ kubernetes_standalone_pod.name }}.yml"
+ state: absent
+
+ ## this is needed in case the role gets included multiple times within the same playbook
+ - name: set config-hash value
+ set_fact:
+ config_hash_value:
- name: generate pod manifest
copy:
@@ -60,9 +67,9 @@
{% if 'labels' in kubernetes_standalone_pod %}
labels:
{{ kubernetes_standalone_pod.labels | to_nice_yaml(indent=2) | indent(4) }}{% endif %}
- {% if config_hash_value is defined or 'annotations' in kubernetes_standalone_pod %}
+ {% if config_hash_value or 'annotations' in kubernetes_standalone_pod %}
annotations:
- {% if config_hash_value is defined %}
+ {% if config_hash_value %}
config-hash: "{{ config_hash_value }}"
{% endif %}
{% if 'annotations' in kubernetes_standalone_pod %}