Use ansible-vault to create a new encrypted variable string.
=$terminal_prompt?> ansible-vault encrypt_string 'Jumped The Shark' --name 'fonzie_stunt'
A breakdown of the command:
ansible-vault
encrypt_string
'this phrase will be encrypted'
--name 'variable_name_of_encrypted_var'
Use ansible-vault to create a new encrypted variable string.
=$terminal_prompt?> ansible-vault encrypt_string 'Jumped The Shark' --name 'fonzie_stunt' New Vault password: fonzieConfirm New Vault password: fonzie
fonzie_stunt: !vault | $ANSIBLE_VAULT;1.1;AES256 35613061636564623138646464393731633534343261393532343263633763356364633366636633 6430663339613762306235323035326663363665316234650a303434333462343731356632333136 37393966336465386131666635333537636133313864383865303138303262343939326563373730 3063376263303037340a356263333131626239316630653465313931353863623237666464613030 37346537336430386265633239346566313466323764336234346361626666643334 Encryption successful =$terminal_prompt?>
The pipe separates the multi-line value from the variable name.
fonzie_stunt: !vault |
$ANSIBLE_VAULT;1.1;AES256
35613061636564623138646464393731633534343261393532343263633763356364633366636633
6430663339613762306235323035326663363665316234650a303434333462343731356632333136
37393966336465386131666635333537636133313864383865303138303262343939326563373730
3063376263303037340a356263333131626239316630653465313931353863623237666464613030
37346537336430386265633239346566313466323764336234346361626666643334