From ab499c2e38c4d6b7490f335f3376fbfe31388675 Mon Sep 17 00:00:00 2001 From: Cedric Girard Date: Thu, 2 Aug 2018 11:27:04 +0200 Subject: [PATCH] 9th exercise: vault --- 90.Vault/90.Vault.md | 15 +++++++++++++++ 90.Vault/solution/solution.yml | 13 +++++++++++++ 90.Vault/solution/vars/vault.yml | 6 ++++++ README.md | 1 + 4 files changed, 35 insertions(+) create mode 100644 90.Vault/90.Vault.md create mode 100644 90.Vault/solution/solution.yml create mode 100644 90.Vault/solution/vars/vault.yml diff --git a/90.Vault/90.Vault.md b/90.Vault/90.Vault.md new file mode 100644 index 0000000..3bd9f62 --- /dev/null +++ b/90.Vault/90.Vault.md @@ -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`. diff --git a/90.Vault/solution/solution.yml b/90.Vault/solution/solution.yml new file mode 100644 index 0000000..74120e4 --- /dev/null +++ b/90.Vault/solution/solution.yml @@ -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: diff --git a/90.Vault/solution/vars/vault.yml b/90.Vault/solution/vars/vault.yml new file mode 100644 index 0000000..47b63d4 --- /dev/null +++ b/90.Vault/solution/vars/vault.yml @@ -0,0 +1,6 @@ +$ANSIBLE_VAULT;1.1;AES256 +38626132653262633464616562613038373233373666323263353031343139373864663765386461 +3365363133633333623838323433366361313439636362370a653136646534623464393063363933 +36396161653238643634653834343638396435666635356335346463623466636665366661326463 +6332666136643361610a323165343535386565613932326665383534316164613632303033396339 +3066 diff --git a/README.md b/README.md index ae20e9e..beaaeac 100644 --- a/README.md +++ b/README.md @@ -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)