ANSIBLE VAULT: ENCRYPTED VARIABLE

Including an encrypted variable in a plaintext playbook.

Ansible Terminal
---
- hosts: localhost
  connection: local
  vars:
    fonzie_show: Happy Days
    fonzie_transport: Motorcycle
    fonzie_stunt: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        35613061636564623138646464393731633534343261393532343263633763356364633366636633
        6430663339613762306235323035326663363665316234650a303434333462343731356632333136
        37393966336465386131666635333537636133313864383865303138303262343939326563373730
        3063376263303037340a356263333131626239316630653465313931353863623237666464613030
        37346537336430386265633239346566313466323764336234346361626666643334               
    fonzie_office: Mens room at Arnold's Diner
    fonzie_jacket: Leather
    fonzie_phrase: Aaaaaaayyyyyyyy

  tasks:
  - name: prove that we can read the variables within the encrypted string
    debug:
      msg: |
        Fonzie is a character from the TV show, {{ fonzie_show }}. He rides a {{ fonzie_transport }},
        wears a {{ fonzie_jacket }} jacket, and has an office in the {{ fonzie_office }}.

        Fonzie is most famous for his stunt where he {{ fonzie_stunt }}, after which,
        he said {{ fonzie_phrase }}!


ANSIBLE VAULT: ENCRYPTED VARIABLE

Including an encrypted variable in a plaintext playbook.

Ansible Terminal
---
- hosts: localhost
  connection: local
  vars:
    fonzie_show: Happy Days
    fonzie_transport: Motorcycle
    fonzie_stunt: !vault |                                                               
        $ANSIBLE_VAULT;1.1;AES256                                                        
        35613061636564623138646464393731633534343261393532343263633763356364633366636633 
        6430663339613762306235323035326663363665316234650a303434333462343731356632333136 
        37393966336465386131666635333537636133313864383865303138303262343939326563373730 
        3063376263303037340a356263333131626239316630653465313931353863623237666464613030 
        37346537336430386265633239346566313466323764336234346361626666643334                    
    fonzie_office: Mens room at Arnold's Diner
    fonzie_jacket: Leather
    fonzie_phrase: Aaaaaaayyyyyyyy

  tasks:
  - name: prove that we can read the variables within the encrypted string
    debug:
      msg: |
        Fonzie is a character from the TV show, {{ fonzie_show }}. He rides a {{ fonzie_transport }},
        wears a {{ fonzie_jacket }} jacket, and has an office in the {{ fonzie_office }}.

        Fonzie is most famous for his stunt where he {{ fonzie_stunt }}, after which,
        he said {{ fonzie_phrase }}!