Skip to content

Commit a326001

Browse files
author
Bryan Kendall
committed
add 1 year backend for aws
1 parent bb39d05 commit a326001

1 file changed

Lines changed: 37 additions & 3 deletions

File tree

ansible/vault-values.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
return_content=yes
3131
register: mounts
3232

33-
- name: mount aws backend in vault
33+
- name: mount 1h aws backend in vault
3434
run_once: true
3535
when: write_values is defined and mounts.json['aws_1h/'] is not defined
3636
uri:
@@ -47,9 +47,26 @@
4747
default_lease_ttl: "3600s" # 1 hour, in seconds
4848
max_lease_ttl: "3600s" # 1 hour, in seconds
4949

50-
- name: configure aws root credentials
50+
- name: mount 1yr aws backend in vault
5151
run_once: true
52-
when: (write_values is defined and write_root_creds is defined) or (write_values is defined and mounts.json['aws/'] is not defined)
52+
when: write_values is defined and mounts.json['aws_1yr/'] is not defined
53+
uri:
54+
method=POST
55+
follow_redirects=all
56+
url=http://{{ ansible_default_ipv4.address }}:8200/v1/sys/mounts/aws_1yr
57+
HEADER_X-Vault-Token="{{ vault_auth_token }}"
58+
body_format=json
59+
body='{{ item | to_json }}'
60+
status_code=204
61+
with_items:
62+
- type: "aws"
63+
config:
64+
default_lease_ttl: "3600s" # 1 hour, in seconds
65+
max_lease_ttl: "3600s" # 1 hour, in seconds
66+
67+
- name: configure 1h aws root credentials
68+
run_once: true
69+
when: (write_values is defined and write_root_creds is defined) or (write_values is defined and mounts.json['aws_1h/'] is not defined)
5370
uri:
5471
method=POST
5572
follow_redirects=all
@@ -64,6 +81,23 @@
6481
secret_key: "{{ vault_aws_secret_key }}"
6582
region: "{{ vault_aws_region }}"
6683

84+
- name: configure 1yr aws root credentials
85+
run_once: true
86+
when: (write_values is defined and write_root_creds is defined) or (write_values is defined and mounts.json['aws_1yr/'] is not defined)
87+
uri:
88+
method=POST
89+
follow_redirects=all
90+
url=http://{{ ansible_default_ipv4.address }}:8200/v1/aws_1yr/config/root
91+
HEADER_X-Vault-Token="{{ vault_auth_token }}"
92+
body_format=json
93+
body='{{ item | to_json }}'
94+
status_code=204
95+
register: creds
96+
with_items:
97+
- access_key: "{{ vault_aws_access_key_id }}"
98+
secret_key: "{{ vault_aws_secret_key }}"
99+
region: "{{ vault_aws_region }}"
100+
67101
- name: check for the dock-init role
68102
run_once: true
69103
when: write_values is defined

0 commit comments

Comments
 (0)