## ANSIBLE VAULT: ENCRYPTED VARIABLE

Use ansible-vault to create a new encrypted variable string.

Ansible Terminal

     ansible-vault encrypt_string 'Jumped The Shark' --name 'fonzie_stunt'

## Here are the pieces

A breakdown of the command:

Ansible Terminal

    ansible-vault
         encrypt_string
             'this phrase will be encrypted'
                 --name 'variable_name_of_encrypted_var'

In this example, we are creating an encrypted string that will be placed into a non-encrypted YAML file.

## ANSIBLE VAULT: ENCRYPTED VARIABLE

Use ansible-vault to create a new encrypted variable string.

Ansible Terminal

     ansible-vault encrypt_string 'Jumped The Shark' --name 'fonzie_stunt'
    New Vault password: fonzie
    Confirm New Vault password: fonzie

    fonzie_stunt: !vault |
              $ANSIBLE_VAULT;1.1;AES256
              35613061636564623138646464393731633534343261393532343263633763356364633366636633
              6430663339613762306235323035326663363665316234650a303434333462343731356632333136
              37393966336465386131666635333537636133313864383865303138303262343939326563373730
              3063376263303037340a356263333131626239316630653465313931353863623237666464613030
              37346537336430386265633239346566313466323764336234346361626666643334

    Encryption successful

The command will output a string that's encrypted against the password you provided.

## ANSIBLE VAULT: ENCRYPTED VARIABLE

The pipe separates the multi-line value from the variable name.

Ansible Terminal

    fonzie_stunt: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        35613061636564623138646464393731633534343261393532343263633763356364633366636633
        6430663339613762306235323035326663363665316234650a303434333462343731356632333136
        37393966336465386131666635333537636133313864383865303138303262343939326563373730
        3063376263303037340a356263333131626239316630653465313931353863623237666464613030
        37346537336430386265633239346566313466323764336234346361626666643334

Copy the encrypted string and paste it into a non-encrypted YAML file.