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.

104 lines
3.0 KiB

9 years ago
  1. ---
  2. - name: Check etcd certs
  3. include_tasks: check_certs.yml
  4. when: cert_management == "script"
  5. tags:
  6. - etcd-secrets
  7. - facts
  8. - name: Generate etcd certs
  9. include_tasks: "gen_certs_script.yml"
  10. when:
  11. - cert_management | d('script') == "script"
  12. tags:
  13. - etcd-secrets
  14. - name: Trust etcd CA
  15. include_tasks: upd_ca_trust.yml
  16. when:
  17. - ('etcd' in group_names) or ('kube_control_plane' in group_names)
  18. tags:
  19. - etcd-secrets
  20. - name: Trust etcd CA on nodes if needed
  21. include_tasks: upd_ca_trust.yml
  22. when:
  23. - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool
  24. - kube_network_plugin != "calico" or calico_datastore == "etcd"
  25. - inventory_hostname in groups['k8s_cluster']
  26. tags:
  27. - etcd-secrets
  28. - name: "Gen_certs | Get etcd certificate serials"
  29. command: "openssl x509 -in {{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem -noout -serial"
  30. register: "etcd_client_cert_serial_result"
  31. changed_when: false
  32. check_mode: false
  33. when:
  34. - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool
  35. - kube_network_plugin != "calico" or calico_datastore == "etcd"
  36. - inventory_hostname in groups['k8s_cluster']
  37. tags:
  38. - master # master tag is deprecated and replaced by control-plane
  39. - control-plane
  40. - network
  41. - name: Set etcd_client_cert_serial
  42. set_fact:
  43. etcd_client_cert_serial: "{{ etcd_client_cert_serial_result.stdout.split('=')[1] }}"
  44. when:
  45. - kube_network_plugin in ["calico", "flannel", "cilium"] or cilium_deploy_additionally | default(false) | bool
  46. - kube_network_plugin != "calico" or calico_datastore == "etcd"
  47. - inventory_hostname in groups['k8s_cluster']
  48. tags:
  49. - master # master tag is deprecated and replaced by control-plane
  50. - control-plane
  51. - network
  52. - name: Install etcdctl and etcdutl binary
  53. import_role:
  54. name: etcdctl_etcdutl
  55. tags:
  56. - etcdctl
  57. - etcdutl
  58. - upgrade
  59. when:
  60. - ('etcd' in group_names)
  61. - etcd_cluster_setup
  62. - name: Install etcd
  63. include_tasks: "install_{{ etcd_deployment_type }}.yml"
  64. when: ('etcd' in group_names)
  65. tags:
  66. - upgrade
  67. - name: Configure etcd
  68. include_tasks: configure.yml
  69. when: ('etcd' in group_names)
  70. - name: Refresh etcd config
  71. include_tasks: refresh_config.yml
  72. when: ('etcd' in group_names)
  73. - name: Restart etcd if certs changed
  74. command: /bin/true
  75. notify: Restart etcd
  76. when:
  77. - ('etcd' in group_names)
  78. - etcd_cluster_setup
  79. - etcd_secret_changed | default(false)
  80. - name: Restart etcd-events if certs changed
  81. command: /bin/true
  82. notify: Restart etcd
  83. when:
  84. - ('etcd' in group_names)
  85. - etcd_events_cluster_setup
  86. - etcd_secret_changed | default(false)
  87. # After etcd cluster is assembled, make sure that
  88. # initial state of the cluster is in `existing`
  89. # state instead of `new`.
  90. - name: Refresh etcd config again for idempotency
  91. include_tasks: refresh_config.yml
  92. when: ('etcd' in group_names)