Encrypt an encrypted file - Ansible Vault

0 votes
I need to encrypt a file only if it is already encrypted. Can add this as a task in my playbook?
Jan 29, 2019 in Ansible by fez
92 views

1 answer to this question.

0 votes

Hey @Fez,

This is one of the way of doing this:

- local_action: shell
    head -1 {{ file }} | grep -v -q \$ANSIBLE_VAULT && ansible-vault encrypt {{ file }}

You'll also need --vault-password-file otherwise Ansible will stop processing and wait on prompt.

answered Jan 29, 2019 by Cerci

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer

View the encrypted file without decrypting - Ansible Vault

Hey @Laksha, you can view the file ...READ MORE

answered Mar 6, 2019 in Ansible by William
306 views
0 votes
1 answer

What files can be encrypted using the Ansible Vault?

Yes @Umang, Ansible Vault is used to ...READ MORE

answered Jan 29, 2019 in Ansible by Kavya
151 views
0 votes
1 answer

How to create a new encrpted file using Ansible Vault?

If you are creating a new file ...READ MORE

answered Jan 29, 2019 in Ansible by Kyraa
153 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,420 points
589 views
0 votes
1 answer
0 votes
1 answer

How to encrypt and existing file using Ansible Vault?

Hey @Kyraa, to encrypt an existing file ...READ MORE

answered Jan 29, 2019 in Ansible by Kavya
1,316 views
0 votes
1 answer

Upload encrypted file using ansible vault?

You can do this, make your playbook ...READ MORE

answered Jan 29, 2019 in Ansible by Faizal
112 views