I have ansible encrypted vault file and have userid and passwords stored in it. I am creating a playbook to change passwords in that file.
I tried to use lineinfile but the text is getting added at then of the encrypted text.
Is there a possibility to edit a vault file thru a playbook
Vault files can be edited thru ansible-vault edit. Not thru vi filename. Vault file contents.
user1:"abc$123098"
user2:"qwe$123098"
I wanted to replace user2 line in the vault file.
ansible code
- name: chainging vault file
lineinfile:
path: /path/testvault.yaml
regexp: '^user1:'
line: 'user1:lkjh$123098'