|
30 | 30 | return_content=yes |
31 | 31 | register: mounts |
32 | 32 |
|
33 | | - - name: mount aws backend in vault |
| 33 | + - name: mount 1h aws backend in vault |
34 | 34 | run_once: true |
35 | 35 | when: write_values is defined and mounts.json['aws_1h/'] is not defined |
36 | 36 | uri: |
|
47 | 47 | default_lease_ttl: "3600s" # 1 hour, in seconds |
48 | 48 | max_lease_ttl: "3600s" # 1 hour, in seconds |
49 | 49 |
|
50 | | - - name: configure aws root credentials |
| 50 | + - name: mount 1yr aws backend in vault |
51 | 51 | 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: "8760h" # 1 year, in hours |
| 65 | + max_lease_ttl: "8760h" # 1 year, in hours |
| 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) |
53 | 70 | uri: |
54 | 71 | method=POST |
55 | 72 | follow_redirects=all |
|
64 | 81 | secret_key: "{{ vault_aws_secret_key }}" |
65 | 82 | region: "{{ vault_aws_region }}" |
66 | 83 |
|
| 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 | + |
67 | 101 | - name: check for the dock-init role |
68 | 102 | run_once: true |
69 | 103 | when: write_values is defined |
|
0 commit comments