Having a file in the inventory named myFile.properties.j2
that is used in a task in one of the roles that a playbook uses
Content of the file :
my.super.pwd=nope
my.otherSuper.pwd= !vault |
$ANSIBLE_VAULT;1.1;AES256
38663664363362333264343934373066623330373736646232663337353062383731346234363937
3131633062366462643261323333303438333330343231370a626639333066303562373964633035
30653433303165333734386131353861366637393430636364386439386666363331656330393830
3961666132396561350a326266633462653335626466623464316461313061373532633136353734
30613030363837333833656239626236323036356265313435636232633031323432626338663838
33663135346364316135386239663063623363656661643635353032636365663464356235396466
663633333832623963393334633666383964
and.antoher= !vault |
$ANSIBLE_VAULT;1.1;AES256
38663664363362333264343934373066623330373736646232663337353062383731346234363937
3131633062366462643261323333303438333330343231370a626639333066303562373964633035
30653433303165333734386131353861366637393430636364386439386666363331656330393830
3961666132396561350a326266633462653335626466623464316461313061373532633136353734
30613030363837333833656239626236323036356265313435636232633031323432626338663838
33663135346364316135386239663063623363656661643635353032636365663464356235396466
663633333832623963393334633666383964
another.pwd.net=nope
and.another.pwd=nope
The task that is using it :
- name: "Template the secrets files"
template:
src: "{{ item.src }}"
dest: "{{ somewhere }}/{{ item.path | basename | regex_replace('.j2$', '') }}"
force: true
mode: '0440'
owner: "{{ somebody }}"
group: root
with_filetree: "{{ some_dir }}"
when: item.state == 'file'
The problem is that once the playbook is played, the file remain like it is and none secret is decrypted.
Any ideas please ?
If i vault all the file it works fine, but when i try to only vault the variables it is not working, the file remain the same.