9th exercise: vault

This commit is contained in:
Cedric Girard 2018-08-02 11:27:04 +02:00
parent cf622c071b
commit ab499c2e38
4 changed files with 35 additions and 0 deletions

15
90.Vault/90.Vault.md Normal file
View File

@ -0,0 +1,15 @@
# 90 - Vault
This exercise makes you create and use an Ansible Vault.
## Vault and Playbook Creation
Create a vault with a var named `password` and the value of your choice.
Create a playbook following the given specs:
* Run on host group `lab`
* Create a `htpasswd` file in `/tmp` (using the corresponding module) containing one user `webuser` and the password stored in the vault.
## Validation
Run the playbook and ensure the `htpasswd` is created.
There is a working playbook in `solution/solution.yml`. It uses a vault stored in `solution/vars/vault.yml` with the password `ansible`.

View File

@ -0,0 +1,13 @@
- hosts: lab
gather_facts: false
vars_files:
- vars/vault.yml
tasks:
- name: Create htpasswd file
htpasswd:
path: /tmp/htpasswd
name: webuser
password: "{{ password }}"
# vim: set ft=yaml sw=2 et:

View File

@ -0,0 +1,6 @@
$ANSIBLE_VAULT;1.1;AES256
38626132653262633464616562613038373233373666323263353031343139373864663765386461
3365363133633333623838323433366361313439636362370a653136646534623464393063363933
36396161653238643634653834343638396435666635356335346463623466636665366661326463
6332666136643361610a323165343535386565613932326665383534316164613632303033396339
3066

View File

@ -14,5 +14,6 @@ Install Ansible and clone this repo. Customize the `hosts` file to your lab setu
1. [Using Facts](60.Facts/60.Facts.md)
1. [Task Delegation](70.Delegate/70.Delegate.md)
1. [Loops](80.Loops/80.Loops.md)
1. [Vault](90.Vault/90.Vault.md)