forked from TerryHowe/ansible-modules-hashivault
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_generate_root.yml
61 lines (53 loc) · 2.56 KB
/
test_generate_root.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
- hosts: localhost
gather_facts: no
vars:
vault_keys: "{{ lookup('env','VAULT_KEYS') }}"
tasks:
- assert:
that: "'{{vault_keys}}' != ''"
msg: "VAULT_KEYS must be set to run this test"
- name: Cancel anything that might be going
hashivault_generate_root_cancel:
register: hashivault_generate_root_cancel
- assert: { that: "{{hashivault_generate_root_cancel.rc}} == 0" }
- name: Generate root token initialize
hashivault_generate_root_init:
register: hashivault_generate_root_init
- assert: { that: "{{hashivault_generate_root_init.changed}} == True" }
- assert: { that: "{{hashivault_generate_root_init.rc}} == 0" }
- name: Generate root status
hashivault_generate_root_status:
register: hashivault_generate_root_status
- assert: { that: "{{hashivault_generate_root_status.changed}} == False" }
- assert: { that: "{{hashivault_generate_root_status.rc}} == 0" }
- name: Generate a root token
hashivault_generate_root:
key: "{{vault_keys}}"
nonce: "{{hashivault_generate_root_init.status.nonce}}"
register: hashivault_generate_root
- assert: { that: "{{hashivault_generate_root.changed}} == True" }
- assert: { that: "{{hashivault_generate_root.rc}} == 0" }
- assert: { that: "{{hashivault_generate_root.status.complete}} == True" }
- name: Generate root token initialize
hashivault_generate_root_init:
register: hashivault_generate_root_init
- assert: { that: "{{hashivault_generate_root_init.changed}} == True" }
- assert: { that: "{{hashivault_generate_root_init.rc}} == 0" }
- name: Generate root status
hashivault_generate_root_status:
register: hashivault_generate_root_status
- assert: { that: "{{hashivault_generate_root_status.changed}} == False" }
- assert: { that: "{{hashivault_generate_root_status.rc}} == 0" }
- assert: { that: "{{hashivault_generate_root_status.status.started}} == True" }
- name: Cancel that
hashivault_generate_root_cancel:
register: hashivault_generate_root_cancel
- assert: { that: "{{hashivault_generate_root_cancel.changed}} == True" }
- assert: { that: "{{hashivault_generate_root_cancel.rc}} == 0" }
- name: Generate root status
hashivault_generate_root_status:
register: hashivault_generate_root_status
- assert: { that: "{{hashivault_generate_root_status.changed}} == False" }
- assert: { that: "{{hashivault_generate_root_status.rc}} == 0" }
- assert: { that: "{{hashivault_generate_root_status.status.started}} == False" }