You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.3 KiB

  1. ---
  2. - include: sync_etcd_master_certs.yml
  3. when: inventory_hostname in groups.etcd
  4. tags: etcd-secrets
  5. - include: sync_etcd_node_certs.yml
  6. when: inventory_hostname in etcd_node_cert_hosts
  7. tags: etcd-secrets
  8. # Issue master certs to Etcd nodes
  9. - include: ../../vault/tasks/shared/issue_cert.yml
  10. vars:
  11. issue_cert_common_name: "etcd:master:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
  12. issue_cert_alt_names: "{{ groups.etcd + ['localhost'] }}"
  13. issue_cert_copy_ca: "{{ item == etcd_master_certs_needed|first }}"
  14. issue_cert_file_group: "{{ etcd_cert_group }}"
  15. issue_cert_file_owner: kube
  16. issue_cert_hosts: "{{ groups.etcd }}"
  17. issue_cert_ip_sans: >-
  18. [
  19. {%- for host in groups.etcd -%}
  20. "{{ hostvars[host]['ansible_default_ipv4']['address'] }}",
  21. {%- if hostvars[host]['ip'] is defined -%}
  22. "{{ hostvars[host]['ip'] }}",
  23. {%- endif -%}
  24. {%- endfor -%}
  25. "127.0.0.1","::1"
  26. ]
  27. issue_cert_path: "{{ item }}"
  28. issue_cert_role: etcd
  29. issue_cert_url: "{{ hostvars[groups.vault|first]['vault_leader_url'] }}"
  30. issue_cert_mount_path: "{{ etcd_vault_mount_path }}"
  31. with_items: "{{ etcd_master_certs_needed|d([]) }}"
  32. when: inventory_hostname in groups.etcd
  33. notify: set etcd_secret_changed
  34. # Issue node certs to everyone else
  35. - include: ../../vault/tasks/shared/issue_cert.yml
  36. vars:
  37. issue_cert_common_name: "etcd:node:{{ item.rsplit('/', 1)[1].rsplit('.', 1)[0] }}"
  38. issue_cert_alt_names: "{{ etcd_node_cert_hosts }}"
  39. issue_cert_copy_ca: "{{ item == etcd_node_certs_needed|first }}"
  40. issue_cert_file_group: "{{ etcd_cert_group }}"
  41. issue_cert_file_owner: kube
  42. issue_cert_hosts: "{{ etcd_node_cert_hosts }}"
  43. issue_cert_ip_sans: >-
  44. [
  45. {%- for host in etcd_node_cert_hosts -%}
  46. "{{ hostvars[host]['ansible_default_ipv4']['address'] }}",
  47. {%- if hostvars[host]['ip'] is defined -%}
  48. "{{ hostvars[host]['ip'] }}",
  49. {%- endif -%}
  50. {%- endfor -%}
  51. "127.0.0.1","::1"
  52. ]
  53. issue_cert_path: "{{ item }}"
  54. issue_cert_role: etcd
  55. issue_cert_url: "{{ hostvars[groups.vault|first]['vault_leader_url'] }}"
  56. issue_cert_mount_path: "{{ etcd_vault_mount_path }}"
  57. with_items: "{{ etcd_node_certs_needed|d([]) }}"
  58. when: inventory_hostname in etcd_node_cert_hosts
  59. notify: set etcd_secret_changed