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
1.7 KiB

9 years ago
  1. ---
  2. - include_tasks: check_certs.yml
  3. when: cert_management == "script"
  4. tags:
  5. - etcd-secrets
  6. - facts
  7. - include_tasks: "gen_certs_{{ cert_management }}.yml"
  8. tags:
  9. - etcd-secrets
  10. - include_tasks: upd_ca_trust.yml
  11. tags:
  12. - etcd-secrets
  13. - name: "Gen_certs | Get etcd certificate serials"
  14. command: "openssl x509 -in {{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem -noout -serial"
  15. register: "etcd_client_cert_serial_result"
  16. changed_when: false
  17. when: inventory_hostname in groups['k8s-cluster']|union(groups['etcd'])|union(groups['calico-rr']|default([]))|unique|sort
  18. tags:
  19. - master
  20. - network
  21. - name: Set etcd_client_cert_serial
  22. set_fact:
  23. etcd_client_cert_serial: "{{ etcd_client_cert_serial_result.stdout.split('=')[1] }}"
  24. when: inventory_hostname in groups['k8s-cluster']|union(groups['etcd'])|union(groups['calico-rr']|default([]))|unique|sort
  25. tags:
  26. - master
  27. - network
  28. - include_tasks: "install_{{ etcd_deployment_type }}.yml"
  29. when: is_etcd_master
  30. tags:
  31. - upgrade
  32. - include_tasks: configure.yml
  33. when: is_etcd_master
  34. - include_tasks: refresh_config.yml
  35. when: is_etcd_master
  36. - name: Restart etcd if certs changed
  37. service:
  38. name: etcd
  39. state: restarted
  40. enabled: yes
  41. when: is_etcd_master and etcd_cluster_setup and etcd_secret_changed|default(false)
  42. - name: Restart etcd-events if certs changed
  43. service:
  44. name: etcd-events
  45. state: restarted
  46. enabled: yes
  47. when: is_etcd_master and etcd_events_cluster_setup and etcd_secret_changed|default(false)
  48. # After etcd cluster is assembled, make sure that
  49. # initial state of the cluster is in `existing`
  50. # state insted of `new`.
  51. - include_tasks: refresh_config.yml
  52. when: is_etcd_master