etcd.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ---
  2. - name: Backup and remove generated etcd certificates
  3. hosts: oo_first_etcd
  4. any_errors_fatal: true
  5. roles:
  6. - etcd_common
  7. post_tasks:
  8. - name: Determine if generated etcd certificates exist
  9. stat:
  10. path: "{{ etcd_conf_dir }}/generated_certs"
  11. register: etcd_generated_certs_dir_stat
  12. - name: Backup generated etcd certificates
  13. command: >
  14. tar -czf {{ etcd_conf_dir }}/etcd-generated-certificate-backup-{{ ansible_date_time.epoch }}.tgz
  15. {{ etcd_conf_dir }}/generated_certs
  16. args:
  17. warn: no
  18. when: etcd_generated_certs_dir_stat.stat.exists | bool
  19. - name: Remove generated etcd certificates
  20. file:
  21. path: "{{ item }}"
  22. state: absent
  23. with_items:
  24. - "{{ etcd_conf_dir }}/generated_certs"
  25. - name: Backup and removed deployed etcd certificates
  26. hosts: oo_etcd_to_config
  27. any_errors_fatal: true
  28. roles:
  29. - etcd_common
  30. post_tasks:
  31. - name: Backup etcd certificates
  32. command: >
  33. tar -czvf /etc/etcd/etcd-server-certificate-backup-{{ ansible_date_time.epoch }}.tgz
  34. {{ etcd_conf_dir }}/ca.crt
  35. {{ etcd_conf_dir }}/server.crt
  36. {{ etcd_conf_dir }}/server.key
  37. {{ etcd_conf_dir }}/peer.crt
  38. {{ etcd_conf_dir }}/peer.key
  39. args:
  40. warn: no
  41. - name: Redeploy etcd certificates
  42. hosts: oo_etcd_to_config
  43. any_errors_fatal: true
  44. roles:
  45. - role: openshift_etcd_server_certificates
  46. etcd_certificates_redeploy: true
  47. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  48. etcd_peers: "{{ groups.oo_etcd_to_config | default([], true) }}"
  49. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  50. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  51. - name: Redeploy etcd client certificates for masters
  52. hosts: oo_masters_to_config
  53. any_errors_fatal: true
  54. roles:
  55. - role: openshift_etcd_client_certificates
  56. etcd_certificates_redeploy: true
  57. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  58. etcd_cert_subdir: "openshift-master-{{ openshift.common.hostname }}"
  59. etcd_cert_config_dir: "{{ openshift.common.config_base }}/master"
  60. etcd_cert_prefix: "master.etcd-"
  61. openshift_ca_host: "{{ groups.oo_first_master.0 }}"
  62. openshift_master_count: "{{ openshift.master.master_count | default(groups.oo_masters | length) }}"
  63. when: groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config