Browse Source
Vault role updates:
Vault role updates:
* using separated vault roles for generate certs with different `O` (Organization) subject field; * configure vault roles for issuing certificates with different `CN` (Common name) subject field; * set `CN` and `O` to `kubernetes` and `etcd` certificates; * vault/defaults vars definition was simplified; * vault dirs variables defined in kubernetes-defaults foles for using shared tasks in etcd and kubernetes/secrets roles; * upgrade vault to 0.8.1; * generate random vault user password for each role by default; * fix `serial` file name for vault certs; * move vault auth request to issue_cert tasks; * enable `RBAC` in vault CI;pull/1607/head
18 changed files with 280 additions and 278 deletions
Unified View
Diff Options
-
1.gitlab-ci.yml
-
41roles/etcd/tasks/gen_certs_vault.yml
-
57roles/kubernetes/secrets/tasks/gen_certs_vault.yml
-
6roles/kubernetes/secrets/tasks/sync_kube_master_certs.yml
-
7roles/kubespray-defaults/defaults/main.yaml
-
187roles/vault/defaults/main.yml
-
17roles/vault/tasks/bootstrap/create_etcd_role.yml
-
12roles/vault/tasks/bootstrap/create_mounts.yml
-
10roles/vault/tasks/bootstrap/create_roles.yml
-
20roles/vault/tasks/bootstrap/gen_vault_certs.yml
-
74roles/vault/tasks/bootstrap/main.yml
-
13roles/vault/tasks/cluster/create_mounts.yml
-
14roles/vault/tasks/cluster/create_roles.yml
-
44roles/vault/tasks/cluster/main.yml
-
5roles/vault/tasks/shared/create_role.yml
-
4roles/vault/tasks/shared/gen_ca.yml
-
1roles/vault/tasks/shared/gen_userpass.yml
-
45roles/vault/tasks/shared/issue_cert.yml
@ -1,17 +0,0 @@ |
|||||
--- |
|
||||
- include: ../shared/auth_backend.yml |
|
||||
vars: |
|
||||
auth_backend_description: A Username/Password Auth Backend primarily used for services needing to issue certificates |
|
||||
auth_backend_path: userpass |
|
||||
auth_backend_type: userpass |
|
||||
delegate_to: "{{ groups.vault|first }}" |
|
||||
run_once: true |
|
||||
|
|
||||
- include: ../shared/create_role.yml |
|
||||
vars: |
|
||||
create_role_name: "{{ vault_etcd_role.name }}" |
|
||||
create_role_group: "{{ vault_etcd_role.group }}" |
|
||||
create_role_policy_rules: "{{ vault_etcd_role.policy_rules }}" |
|
||||
create_role_options: "{{ vault_etcd_role.role_options }}" |
|
||||
create_role_mount_path: "{{ vault_etcd_role.mount_path }}" |
|
||||
when: inventory_hostname in groups.etcd |
|
@ -0,0 +1,12 @@ |
|||||
|
--- |
||||
|
- include: ../shared/create_mount.yml |
||||
|
vars: |
||||
|
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.vault|combine({'config_ca': not vault_ca_cert_needed}) }}" |
||||
|
- "{{ vault_pki_mounts.etcd|combine({'config_ca': not vault_etcd_ca_cert_needed}) }}" |
@ -0,0 +1,10 @@ |
|||||
|
--- |
||||
|
- include: ../shared/create_role.yml |
||||
|
vars: |
||||
|
create_role_name: "{{ item.name }}" |
||||
|
create_role_group: "{{ item.group }}" |
||||
|
create_role_policy_rules: "{{ item.policy_rules }}" |
||||
|
create_role_password: "{{ item.password }}" |
||||
|
create_role_options: "{{ item.role_options }}" |
||||
|
create_role_mount_path: "{{ mount.name }}" |
||||
|
with_items: "{{ mount.roles }}" |
@ -1,29 +1,21 @@ |
|||||
--- |
--- |
||||
|
|
||||
- name: boostrap/gen_vault_certs | Add the vault role |
|
||||
uri: |
|
||||
url: "{{ vault_leader_url }}/v1/{{ vault_ca_options.common_name }}/roles/vault" |
|
||||
headers: "{{ vault_headers }}" |
|
||||
method: POST |
|
||||
body_format: json |
|
||||
body: "{{ vault_default_role_permissions }}" |
|
||||
status_code: 204 |
|
||||
when: inventory_hostname == groups.vault|first and vault_api_cert_needed |
|
||||
|
|
||||
- include: ../shared/issue_cert.yml |
- include: ../shared/issue_cert.yml |
||||
vars: |
vars: |
||||
|
issue_cert_common_name: "{{ vault_pki_mounts.vault.roles[0].name }}" |
||||
issue_cert_alt_names: "{{ groups.vault + ['localhost'] }}" |
issue_cert_alt_names: "{{ groups.vault + ['localhost'] }}" |
||||
issue_cert_hosts: "{{ groups.vault }}" |
issue_cert_hosts: "{{ groups.vault }}" |
||||
issue_cert_ip_sans: >- |
issue_cert_ip_sans: >- |
||||
[ |
[ |
||||
{%- for host in groups.vault -%} |
{%- for host in groups.vault -%} |
||||
"{{ hostvars[host]['ansible_default_ipv4']['address'] }}", |
"{{ hostvars[host]['ansible_default_ipv4']['address'] }}", |
||||
|
{%- if hostvars[host]['ip'] is defined -%} |
||||
|
"{{ hostvars[host]['ip'] }}", |
||||
|
{%- endif -%} |
||||
{%- endfor -%} |
{%- endfor -%} |
||||
"127.0.0.1","::1" |
"127.0.0.1","::1" |
||||
] |
] |
||||
issue_cert_mount_path: "{{ vault_ca_options.common_name }}" |
|
||||
|
issue_cert_mount_path: "{{ vault_pki_mounts.vault.name }}" |
||||
issue_cert_path: "{{ vault_cert_dir }}/api.pem" |
issue_cert_path: "{{ vault_cert_dir }}/api.pem" |
||||
issue_cert_headers: "{{ hostvars[groups.vault|first]['vault_headers'] }}" |
|
||||
issue_cert_role: vault |
|
||||
|
issue_cert_role: "{{ vault_pki_mounts.vault.roles[0].name }}" |
||||
issue_cert_url: "{{ vault_leader_url }}" |
issue_cert_url: "{{ vault_leader_url }}" |
||||
when: vault_api_cert_needed |
when: vault_api_cert_needed |
@ -0,0 +1,13 @@ |
|||||
|
--- |
||||
|
- include: ../shared/create_mount.yml |
||||
|
vars: |
||||
|
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.name != vault_pki_mounts.kube.name }}" |
||||
|
with_items: |
||||
|
- "{{ vault_pki_mounts.vault }}" |
||||
|
- "{{ vault_pki_mounts.etcd }}" |
||||
|
- "{{ vault_pki_mounts.kube }}" |
@ -1,18 +1,10 @@ |
|||||
--- |
--- |
||||
- include: ../shared/auth_backend.yml |
|
||||
vars: |
|
||||
auth_backend_description: A Username/Password Auth Backend primarily used for services needing to issue certificates |
|
||||
auth_backend_path: userpass |
|
||||
auth_backend_type: userpass |
|
||||
when: inventory_hostname == groups.vault|first |
|
||||
|
|
||||
- include: ../shared/create_role.yml |
- include: ../shared/create_role.yml |
||||
vars: |
vars: |
||||
create_role_name: "{{ item.name }}" |
create_role_name: "{{ item.name }}" |
||||
create_role_group: "{{ item.group }}" |
create_role_group: "{{ item.group }}" |
||||
|
create_role_password: "{{ item.password }}" |
||||
create_role_policy_rules: "{{ item.policy_rules }}" |
create_role_policy_rules: "{{ item.policy_rules }}" |
||||
create_role_options: "{{ item.role_options }}" |
create_role_options: "{{ item.role_options }}" |
||||
create_role_mount_path: "{{ item.mount_path }}" |
|
||||
with_items: |
|
||||
- "{{ vault_etcd_role }}" |
|
||||
- "{{ vault_kube_role }}" |
|
||||
|
create_role_mount_path: "{{ vault_pki_mounts.kube.name }}" |
||||
|
with_items: "{{ vault_pki_mounts.kube.roles }}" |
Write
Preview
Loading…
Cancel
Save