scaleup.yml 3.3 KB

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