add better delete verification
data:
value: 'ephemeral_stuff'
- - hashivault_write:
+ - name: Write a value to the secret store
+ hashivault_write:
secret: 'name'
data:
value: 'secret_stuff'
- - hashivault_read:
+ - name: Read the secret value
+ hashivault_read:
secret: 'name'
key: 'value'
register: 'vault_read'
- assert: { that: "'{{vault_read.value}}' == 'secret_stuff'" }
- - name: Read a value from the ephemeral secret store
+ - name: Read the ephemeral value
hashivault_read:
secret: '/ephemeral/name'
key: 'value'
- assert: { that: "{{vault_secret_eph_delete.rc}} == 0" }
- assert: { that: "'{{vault_secret_eph_delete.msg}}' == 'Secret ephemeral/name deleted'" }
+ - name: Make sure secret value is gone
+ hashivault_read:
+ secret: 'name'
+ register: 'vault_read'
+ failed_when: False
+ - assert: { that: "{{vault_read.changed}} == False" }
+ - assert: { that: "'{{vault_read.msg}}' == 'Secret name is not in vault'" }
+
+ - name: Make sure ephemeral value is gone
+ hashivault_read:
+ secret: '/ephemeral/name'
+ register: 'vault_read'
+ failed_when: False
+ - assert: { that: "{{vault_read.changed}} == False" }
+ - assert: { that: "'{{vault_read.msg}}' == 'Secret ephemeral/name is not in vault'" }
+
+ - set_fact:
- name: Disable ephermeral secret store
hashivault_secret_disable:
name: "ephemeral"
