I need to encrypt a file using ansible-vault
. I would like to perform the encryption only if the file is not already encrypted by ansible vault. I am trying to use this task in my Ansible playbook:
- local_action: command
ansible-vault encrypt path/to/file
when: <when file is not already encrypted by ansible-vault>
Is there a logic to use in the conditional statement that will check if a file is already encrypted by ansible-vault
?