forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor vault role (kubernetes-sigs#2733)
* Move front-proxy-client certs back to kube mount We want the same CA for all k8s certs * Refactor vault to use a third party module The module adds idempotency and reduces some of the repetitive logic in the vault role Requires ansible-modules-hashivault on ansible node and hvac on the vault hosts themselves Add upgrade test scenario Remove bootstrap-os tags from tasks * fix upgrade issues * improve unseal logic * specify ca and fix etcd check * Fix initialization check bump machine size
- Loading branch information
Showing
49 changed files
with
436 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
pbr>=1.6 | ||
ansible>=2.4.0 | ||
netaddr | ||
jinja2>=2.9.6 | ||
netaddr | ||
pbr>=1.6 | ||
ansible-modules-hashivault>=3.9.4 | ||
hvac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
changed_when: false | ||
with_items: | ||
- python | ||
- python-apt | ||
- pip | ||
- dbus-daemon | ||
tags: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,5 @@ | |
|
||
- import_tasks: set_resolv_facts.yml | ||
tags: | ||
- bootstrap-os | ||
- resolvconf | ||
- facts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
kube_cert_group: kube-cert | ||
kube_vault_mount_path: kube | ||
front_proxy_vault_mount_path: front-proxy | ||
kube_vault_mount_path: "/kube" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
- name: restart vault | ||
command: /bin/true | ||
notify: | ||
- restart vault service | ||
- set facts about local Vault health | ||
- unseal vault | ||
|
||
- name: wait for vault up | ||
uri: | ||
url: "{{ vault_leader_url | default('https://localhost:8200') }}/v1/sys/health" | ||
headers: "{{ vault_client_headers }}" | ||
status_code: "{{ vault_successful_http_codes | join(',') }}" | ||
register: vault_health_check | ||
until: vault_health_check|succeeded | ||
retries: 10 | ||
delay: "{{ retry_stagger | random + 3 }}" | ||
run_once: yes | ||
notify: set facts about local Vault health | ||
|
||
- name: wait for vault up nowait | ||
uri: | ||
url: "{{ vault_leader_url | default('https://localhost:8200') }}/v1/sys/health" | ||
headers: "{{ vault_client_headers }}" | ||
status_code: "{{ vault_successful_http_codes | join(',') }}" | ||
register: vault_health_check | ||
run_once: yes | ||
failed_when: false | ||
notify: set facts about local Vault health | ||
|
||
- name: set facts about local Vault health | ||
set_fact: | ||
vault_is_running: "{{ vault_health_check.get('status', '-1') in vault_successful_http_codes }}" | ||
vault_cluster_is_initialized: "{{ vault_health_check.get('json', {}).get('initialized', false) }}" | ||
vault_is_sealed: "{{ vault_health_check.get('json', {}).get('sealed', true) }}" | ||
|
||
- name: restart vault service | ||
systemd: | ||
daemon_reload: true | ||
enabled: yes | ||
name: vault | ||
state: restarted | ||
|
||
- name: unseal vault | ||
hashivault_unseal: | ||
url: "{{ vault_leader_url | default('https://localhost:8200') }}" | ||
token: "{{ vault_root_token }}" | ||
ca_cert: "{{ vault_cert_dir }}/ca.pem" | ||
keys: "{{ item }}" | ||
with_items: "{{ vault_unseal_keys|default([]) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
--- | ||
- include_tasks: ../shared/create_mount.yml | ||
vars: | ||
create_mount_path: "{{ item.name }}" | ||
create_mount_path: "/{{ item.name }}" | ||
create_mount_default_lease_ttl: "{{ item.default_lease_ttl }}" | ||
create_mount_max_lease_ttl: "{{ item.max_lease_ttl }}" | ||
create_mount_description: "{{ item.description }}" | ||
create_mount_cert_dir: "{{ item.cert_dir }}" | ||
create_mount_config_ca_needed: "{{ item.config_ca }}" | ||
with_items: | ||
- "{{ vault_pki_mounts.userpass|combine({'config_ca': not vault_ca_cert_needed}) }}" | ||
- "{{ vault_pki_mounts.vault|combine({'config_ca': not vault_ca_cert_needed}) }}" | ||
- "{{ vault_pki_mounts.etcd|combine({'config_ca': not vault_etcd_ca_cert_needed}) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.