81398e847ec3721d53ee5d074e458b37e9e9dd65
- Updated all tasks to use fully qualified module names (e.g., ansible.builtin.shell, ansible.builtin.copy) for clarity and to avoid ambiguity. - Replaced deprecated 'yum' module with 'dnf' for package management on RedHat-based systems. - Improved formatting and consistency in task definitions, including the use of double quotes for strings and consistent indentation. - Removed unnecessary comments and whitespace to enhance readability. - Ensured that conditions and loops are consistently formatted across all tasks.
# ====================
# Encrypting content with Ansible Vault
# ====================
# see:
# https://docs.ansible.com/ansible/latest/vault_guide
#
# https://docs.ansible.com/ansible/latest/vault_guide/vault_encrypting_content.html
# ----------
# encrypt / decrypt variables / strings
# ---------
# encrypt string
#
string=nSLIgazSj8DLu2Sy0l
ansible-vault encrypt_string $string && echo
# output of the above command is:
#
!vault |
$ANSIBLE_VAULT;1.1;AES256
33656466386662303431383037386564666466643364376233623261346235363866656438396532
6161373832366430653235343034653166303561383934390a666432356463386461656363303234
61386330643664666539343336313666346261323435386264396137366533626539396434303463
3961666632646337360a666662323063316134623332333239616332343939326331383632646139
66316333653232383764376264616238323861323530343734653564393737386139
# decrypt the encrypted string:
#
echo -e '$ANSIBLE_VAULT;1.1;AES256
33656466386662303431383037386564666466643364376233623261346235363866656438396532
6161373832366430653235343034653166303561383934390a666432356463386461656363303234
61386330643664666539343336313666346261323435386264396137366533626539396434303463
3961666632646337360a666662323063316134623332333239616332343939326331383632646139
66316333653232383764376264616238323861323530343734653564393737386139' | ansible-vault decrypt && echo
# output shoud be:
#
Decryption successful
nSLIgazSj8DLu2Sy0l
# ----------
# encrypt / decrypt file
# ----------
ansible-vault encrypt <file-name>
ansible-vault decrypt <file-name>
Description
Languages
Vim Script
75%
Shell
14.2%
Jinja
8.8%
Python
2%