Skip to content

Commit febb751

Browse files
authored
Vault pki followup (#31)
* Fix vault_pki_write_certificates_host * Followup fixes * Make meta/main.yml the similar in all three roles
1 parent 0555ac4 commit febb751

File tree

8 files changed

+17
-7
lines changed

8 files changed

+17
-7
lines changed

roles/vault/meta/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
---
2+
# WORKAROUND: Without this, we see the following in some setups:
3+
# ERROR! couldn't resolve module/action 'hashivault_unseal'. This often indicates a misspelling, missing collection, or incorrect module path.
4+
# Seen using Kayobe on Ansible 2.10.17, running modules on a remote host.
25
collections:
36
- community.docker

roles/vault_pki/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ Role variables
2525
* `vault_pki_root_default_lease_ttl`: The default time in hours before expiry of the root CA certificate (default: "43830h")
2626
* `vault_pki_root_max_lease_ttl`: The max time in hours that is allowed before expiry of the root CA certificate (default: "43830h")
2727
* `vault_pki_root_ttl`: The time in hours before the root CA certificate expires (default: "43830h")
28-
* `vault_pki_root_key_bits`: The key bits for the root RSA private key (default: "4096")
28+
* `vault_pki_root_key_bits`: The key bits for the root RSA private key (default: 4096)
2929
---
3030
* Vault Create Intermediate
3131
* `vault_pki_intermediate_create`: whether to create an intermediate CA or not (default: `true`)
3232
* `vault_pki_intermediate_import`: whether to import a pre-existing intermediate pem bundle (default: `false`)
3333
* `vault_pki_intermediate_export`: whether to export the generated intermediate pem bundle (default: `false`)
3434
* Mandatory if `vault_pki_intermediate_create` equals `true`
3535
* `vault_pki_intermediate_ca_name`: The name of the Intermediate CA to create
36-
* `vault_pki_intermediate_ca_common_name`: The common name of the RootCA (default: `vault_pki_intermediate_ca_name`)
36+
* `vault_pki_intermediate_ca_common_name`: The common name of the Intermediate CA (default: `vault_pki_intermediate_ca_name`)
3737
* Mandatory if `vault_pki_intermediate_import`: equals `true`
3838
* `vault_pki_intermediate_ca_bundle`: Concatenated certificate, intermediate and private key
3939
* `vault_pki_intermediate_default_lease_ttl`: The default time in hours before expiry of the intermediate CA certificate (default: "43830h")
4040
* `vault_pki_intermediate_max_lease_ttl`: The max time in hours that is allowed before expiry of the intermediate CA certificate (default: "43830h")
4141
* `vault_pki_intermediate_ttl`: The time in hours before the intermediate CA certificate expires (default: "43830h")
42-
* `vault_pki_intermediate_key_bits`: The key bits for the intermediate RSA private key (default: "4096")
42+
* `vault_pki_intermediate_key_bits`: The key bits for the intermediate RSA private key (default: 4096)
4343
* `vault_pki_intermediate_roles`: Certificate Roles to create for the intermediate CA. List of Dicts containing `{name: <role_name>, config: { <pki_option>: <value> ...}`
4444
---
4545
* Certificate Output

roles/vault_pki/meta/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
# WORKAROUND: Without this, we see the following in some setups:
3+
# ERROR! couldn't resolve module/action 'hashivault_unseal'. This often indicates a misspelling, missing collection, or incorrect module path.
4+
# Seen using Kayobe on Ansible 2.10.17, running modules on a remote host.
5+
collections:
6+
- community.general

roles/vault_pki/tasks/create_cert.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
{{ item.data.private_key }}
1919
dest: "{{ vault_pki_certificates_directory }}/{{ item.item.common_name | replace(' ', '-') }}.pem"
2020
mode: 0600
21-
delegate_to: "{{ vault_pki_certificates_host }}"
21+
delegate_to: "{{ vault_pki_write_certificates_host }}"
2222
loop: "{{ certificate_data.results }}"
2323
when: vault_pki_write_certificate_files | bool

roles/vault_pki/tasks/intermediate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
{{ intermediate_ca_csr.data.private_key }}
6767
dest: "{{ vault_pki_certificates_directory }}/{{ vault_pki_intermediate_ca_name |replace(' ', '-') }}.pem"
6868
mode: 0600
69-
delegate_to: "{{ vault_pki_certificates_host }}"
69+
delegate_to: "{{ vault_pki_write_certificates_host }}"
7070
when:
7171
- vault_pki_intermediate_export | bool
7272

roles/vault_pki/tasks/prechecks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
- vars[item.name] | length == 0
77
- item.when
88
loop:
9+
- { "name": "vault_api_addr", "when": true }
10+
- { "name": "vault_token", when: true }
911
- { "name": "vault_pki_root_ca_name", "when": "vault_pki_root_create | bool" }
1012
- { "name": "vault_pki_intermediate_ca_name", "when": "vault_pki_intermediate_create | bool" }

roles/vault_pki/tasks/root.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
{{ root_ca_data.data.certificate }}
3030
dest: "{{ vault_pki_certificates_directory }}/{{ vault_pki_root_ca_name | replace(' ', '-') }}.pem"
3131
mode: 0600
32-
delegate_to: "{{ vault_pki_certificates_host }}"
32+
delegate_to: "{{ vault_pki_write_certificates_host }}"
3333
when:
3434
- vault_pki_write_root_ca_to_file | bool

roles/vault_unseal/tasks/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
url: "{{ vault_api_addr }}"
2121
username: "{{ vault_unseal_username | default(omit) }}"
2222
verify: "{{ vault_unseal_verify | default(omit) }}"
23-
register: vault_unseal_status
2423

2524
- name: Fail if vault is sealed (something went wrong)
2625
uri:

0 commit comments

Comments
 (0)