Member-only story

Encrypt with Ansible-Vault

Maciej
5 min readSep 12, 2019

--

Introduction

I’ve written an article that says “Create a user with an encrypted password.”
I didn’t use ansible-vault because I wanted to encrypt one variable instead of the whole file. I didn’t want to display the password when creating the user in plain text anyway, so I used the password encrypted with python as it was pasted in the playbook. I think, it was good at the time because it went well, but the items I want to encrypt increase more and more. The scenes that can be supported with python encryption are limited to the above cases. How can you encrypt only one item of variable since the version has been improved? If you search there were.

Check ansible-vault help

It’s cumbersome to check the help by hitting the command one by one, so I put it in the article.
If you want to check the text of the article immediately, ask them to skip it.

ansible-vault -h

ansible-vault -h
Usage: ansible-vault [create|decrypt|edit|encrypt|encrypt_string|rekey|view] [options] [vaultfile.yml]

encryption/decryption utility for Ansible data files

Options:
--ask-vault-pass ask for vault password
-h, --help show…

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet