forked from viczem/ansible-keepass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-playbook.yml
54 lines (45 loc) · 2.28 KB
/
example-playbook.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
---
- name: Example
hosts: 127.0.0.1
connection: local
vars:
spam_login: "{{ lookup('viczem.keepass.keepass', 'spam', 'username') }}"
spam_password: "{{ lookup('viczem.keepass.keepass', 'spam', 'password') }}"
ham_login: "{{ lookup('viczem.keepass.keepass', 'example/ham', 'username') }}"
ham_password: "{{ lookup('viczem.keepass.keepass', 'example/ham', 'password') }}"
slash_login: "{{ lookup('viczem.keepass.keepass', 'slash\\/group/slash\\/title', 'username') }}"
slash_url: "{{ lookup('viczem.keepass.keepass', 'slash\\/group/slash\\/title', 'url') }}"
pork_custom_property: "{{ lookup('viczem.keepass.keepass', 'example/pork', 'custom_properties', 'pork_custom_property')}}"
attachment: "{{ lookup('viczem.keepass.keepass', 'example/pork', 'attachments', 'test.txt')}}"
keepass_attachment_1_name: "attachment_1.txt"
keepass_attachment_2_name: "attachment_2.zip"
tasks:
- debug:
msg: "fetch entry: '/spam'; username: '{{ spam_login }}'; password: '{{ spam_password }}'"
- debug:
msg: "fetch entry: '/examples/ham'; username: '{{ ham_login }}'; password: '{{ ham_password }}'"
- debug:
msg: "fetch entry: '/examples/port'; attachments: 'text.txt' - '{{ attachment }}'"
- name: pause to emulate long time operation (greater than keepass_ttl)
pause:
seconds: 5
- debug:
msg: "fetch entry: '/examples/pork'; custom_properties: 'pork_custom_property' - '{{ pork_custom_property }}'"
- debug:
msg: "fetch entry: '/slash\\/group/slash\\/title'; username: '{{ slash_login }}'; url: '{{ slash_url }}'"
- debug: "{{ lookup('viczem.keepass.keepass', 'close') }}"
- name: "Export file: {{ keepass_attachment_1_name }}"
viczem.keepass.attachment:
database: "{{ keepass_dbx }}"
password: "{{ keepass_psw }}"
entrypath: example/attachments
attachment: "{{ keepass_attachment_1_name }}"
dest: "{{ keepass_attachment_1_name }}"
- name: "Export file: {{ keepass_attachment_2_name }}"
viczem.keepass.attachment:
database: "{{ keepass_dbx }}"
password: "{{ keepass_psw }}"
entrypath: example/attachments
attachment: "{{ keepass_attachment_2_name }}"
dest: "{{ keepass_attachment_2_name }}"
mode: 0600