Skip to content

Commit 2714b4f

Browse files
author
Dmitriy Rabotyagov
committed
Fix conditional on ansible_vault_in_place_copy
When ansible_vault_in_place_copy is supploed as extra var it is not always treated a False properly, still messing up with conditions Using bool filter help to eliminate such behaviour. Also reduce verbosity of blockinfile loop by using loop label. Change-Id: Iafaf53c77288d8f45b0bf0ddd99fe242a9f6e7cb
1 parent 6a600eb commit 2714b4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

encrypt_secrets/roles/ansible_vault/tasks/ansible_vault_strings.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
when:
7777
- _secrets is defined
7878
- _secrets | length > 0
79-
- ansible_vault_in_place_copy
79+
- ansible_vault_in_place_copy | bool
8080

8181
- name: Place encrypted secrets in independent blocks
8282
ansible.builtin.blockinfile:
@@ -85,10 +85,12 @@
8585
marker: "# {mark} ANSIBLE MANAGED {{ item.item['key'] }}"
8686
mode: "0600"
8787
loop: "{{ new_secrets.results }}"
88+
loop_control:
89+
label: "{{ item.item['key'] }}"
8890
when:
8991
- _secrets is defined
9092
- _secrets | length > 0
91-
- not ansible_vault_in_place_copy
93+
- not ansible_vault_in_place_copy | bool
9294

9395
- name: Undefine the secrets variable
9496
ansible.builtin.set_fact:

0 commit comments

Comments
 (0)