-2

How to encrypt roles in Ansible using ansible vault, I have multiple roles inside one project and from source code protection perspective we want to encrypt whole roles not particular playbooks.

  • 2
    I think it would help if you add a little more context to your question. What are you trying to achieve and maybe a short glimpse into why ? – klaas Aug 27 '20 at 19:55

2 Answers2

2

But why? It sounds not logical to encyrpt/decrypt roles and playbooks. You should only do this with passwords.

If you really want to store your roles securely, you could look at alternate methods, such as zip with the password function.

Kevin C
  • 4,851
  • 8
  • 30
  • 64
-1

Yes this is feasible and I have tested it properly. Though this is not recommended and best practice to encrypt all files.

  • 3
    If you're going to post an answer, please make it useful for someone else that might encounter this question. An answer of "cool, I solved it" with no details of how is incredibly frustrating for someone with a problem. – lxop Aug 27 '20 at 20:46
  • 1
    find . -type f -printf "%h/\"%f\" " | xargs ansible-vault encrypt This way you encrypt in one go. – PRAVEEN SINGH Pokharia Aug 31 '20 at 17:10