scaleup.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ---
  2. - name: Configure etcd
  3. hosts: oo_new_etcd_to_config
  4. serial: 1
  5. any_errors_fatal: true
  6. pre_tasks:
  7. - import_role:
  8. name: etcd
  9. tasks_from: add_new_member.yml
  10. - import_role:
  11. name: etcd
  12. tasks_from: server_certificates.yml
  13. vars:
  14. etcd_peers: "{{ groups.oo_new_etcd_to_config | default([], true) }}"
  15. etcd_certificates_etcd_hosts: "{{ groups.oo_new_etcd_to_config | default([], true) }}"
  16. tasks:
  17. - import_role:
  18. name: os_firewall
  19. when: etcd_add_check.rc == 0
  20. - import_role:
  21. name: etcd
  22. when: etcd_add_check.rc == 0
  23. vars:
  24. etcd_peers: "{{ groups.oo_etcd_to_config | union(groups.oo_new_etcd_to_config)| default([], true) }}"
  25. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  26. etcd_initial_cluster_state: "existing"
  27. etcd_initial_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') | regex_replace('\"','') }}"
  28. etcd_ca_setup: False
  29. - import_role:
  30. name: nickhammond.logrotate
  31. when: etcd_add_check.rc == 0
  32. # etcd_hostname fact is set in add_new_member.yml called above.
  33. - name: Verify cluster is stable
  34. command: >
  35. {{ r_etcd_common_etcdctl_command }}
  36. --cert-file {{ etcd_peer_cert_file }}
  37. --key-file {{ etcd_peer_key_file }}
  38. --ca-file {{ etcd_peer_ca_file }}
  39. -C {{ etcd_peer_url_scheme }}://{{ hostvars[etcd_ca_host].etcd_hostname }}:{{ etcd_client_port }}
  40. cluster-health
  41. register: scaleup_health
  42. retries: 3
  43. delay: 30
  44. until: scaleup_health.rc == 0
  45. - name: Update master etcd client urls
  46. hosts: oo_masters_to_config
  47. serial: 1
  48. pre_tasks:
  49. - set_fact:
  50. openshift_master_etcd_hosts: "{{ hostvars
  51. | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | union(groups['oo_new_etcd_to_config'] | default([]) ))
  52. | lib_utils_oo_collect('openshift.common.hostname')
  53. | default(none, true) }}"
  54. openshift_master_etcd_port: "{{ etcd_client_port | default('2379') }}"
  55. openshift_no_proxy_etcd_host_ips: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | default([]))
  56. | lib_utils_oo_collect('openshift.common.ip') | default([]) | join(',')
  57. }}"
  58. # This fact requires the facts set above, so needs to happen in it's own task.
  59. - set_fact:
  60. # lib_utils_oo_etcd_host_urls is a custom filter plugin in roles/lib_utils/filter_plugins/oo_filters.py
  61. openshift_master_etcd_urls: "{{ openshift_master_etcd_hosts | lib_utils_oo_etcd_host_urls(l_use_ssl, openshift_master_etcd_port) }}"
  62. vars:
  63. l_use_ssl: "{{ openshift_master_etcd_use_ssl | default(True) | bool}}"
  64. post_tasks:
  65. - import_role:
  66. name: openshift_control_plane
  67. tasks_from: update_etcd_client_urls.yml