scaleup.yml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. # etcd_hostname fact is set in add_new_member.yml called above.
  30. - name: Verify cluster is stable
  31. command: >
  32. {{ r_etcd_common_etcdctl_command }}
  33. --cert-file {{ etcd_peer_cert_file }}
  34. --key-file {{ etcd_peer_key_file }}
  35. --ca-file {{ etcd_peer_ca_file }}
  36. -C {{ etcd_peer_url_scheme }}://{{ hostvars[etcd_ca_host].etcd_hostname }}:{{ etcd_client_port }}
  37. cluster-health
  38. register: scaleup_health
  39. retries: 3
  40. delay: 30
  41. until: scaleup_health.rc == 0
  42. - name: Update master etcd client urls
  43. hosts: oo_masters_to_config
  44. serial: 1
  45. pre_tasks:
  46. - set_fact:
  47. openshift_master_etcd_hosts: "{{ hostvars
  48. | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | union(groups['oo_new_etcd_to_config'] | default([]) ))
  49. | lib_utils_oo_collect('openshift.common.hostname')
  50. | default(none, true) }}"
  51. openshift_master_etcd_port: "{{ etcd_client_port | default('2379') }}"
  52. openshift_no_proxy_etcd_host_ips: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | default([]))
  53. | lib_utils_oo_collect('openshift.common.ip') | default([]) | join(',')
  54. }}"
  55. # This fact requires the facts set above, so needs to happen in it's own task.
  56. - set_fact:
  57. # lib_utils_oo_etcd_host_urls is a custom filter plugin in roles/lib_utils/filter_plugins/oo_filters.py
  58. openshift_master_etcd_urls: "{{ openshift_master_etcd_hosts | lib_utils_oo_etcd_host_urls(l_use_ssl, openshift_master_etcd_port) }}"
  59. vars:
  60. l_use_ssl: "{{ openshift_master_etcd_use_ssl | default(True) | bool}}"
  61. post_tasks:
  62. - import_role:
  63. name: openshift_control_plane
  64. tasks_from: update_etcd_client_urls.yml