scaleup.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ---
  2. - name: Check for etcd stand-alone hosts on atomic
  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. - name: Set etcd facts for all hosts
  14. hosts: oo_etcd_to_config:oo_new_etcd_to_config
  15. tasks:
  16. - import_role:
  17. name: etcd
  18. tasks_from: set_facts.yml
  19. - name: Configure etcd
  20. hosts: oo_new_etcd_to_config
  21. serial: 1
  22. any_errors_fatal: true
  23. tasks:
  24. - import_role:
  25. name: etcd
  26. tasks_from: add_new_member.yml
  27. vars:
  28. etcd_peer: "{{ hostvars[etcd_ca_host].etcd_ip }}"
  29. - import_role:
  30. name: etcd
  31. tasks_from: server_certificates.yml
  32. vars:
  33. etcd_peers: "{{ groups.oo_new_etcd_to_config | default([], true) }}"
  34. etcd_certificates_etcd_hosts: "{{ groups.oo_new_etcd_to_config | default([], true) }}"
  35. - import_role:
  36. name: os_firewall
  37. when: etcd_add_check.rc == 0
  38. # Setup etcd as a static pod if collocated with a master
  39. - import_role:
  40. name: etcd
  41. tasks_from: static.yml
  42. when:
  43. - etcd_add_check.rc == 0
  44. - inventory_hostname in groups['oo_masters']
  45. vars:
  46. etcd_peers: "{{ groups.oo_etcd_to_config | union(groups.oo_new_etcd_to_config)| default([], true) }}"
  47. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  48. etcd_initial_cluster_state: "existing"
  49. etcd_initial_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') | regex_replace('\"','') }}"
  50. etcd_ca_setup: False
  51. - import_role:
  52. name: etcd
  53. tasks_from: rpm.yml
  54. when:
  55. - etcd_add_check.rc == 0
  56. - not inventory_hostname in groups['oo_masters']
  57. vars:
  58. etcd_peers: "{{ groups.oo_etcd_to_config | union(groups.oo_new_etcd_to_config)| default([], true) }}"
  59. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  60. etcd_initial_cluster_state: "existing"
  61. etcd_initial_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') | regex_replace('\"','') }}"
  62. etcd_ca_setup: False
  63. - import_role:
  64. name: etcd
  65. tasks_from: verify_cluster_health.yml
  66. - name: Update master etcd client urls
  67. hosts: oo_masters_to_config
  68. serial: 1
  69. tasks:
  70. - set_fact:
  71. openshift_master_etcd_hosts: "{{ hostvars
  72. | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | union(groups['oo_new_etcd_to_config'] | default([]) ))
  73. | lib_utils_oo_collect('openshift.common.hostname')
  74. | default(none, true) }}"
  75. openshift_master_etcd_port: "{{ etcd_client_port | default('2379') }}"
  76. openshift_no_proxy_etcd_host_ips: "{{ hostvars | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | default([]))
  77. | lib_utils_oo_collect('openshift.common.ip') | default([]) | join(',')
  78. }}"
  79. # This fact requires the facts set above, so needs to happen in it's own task.
  80. - set_fact:
  81. # lib_utils_oo_etcd_host_urls is a custom filter plugin in roles/lib_utils/filter_plugins/oo_filters.py
  82. openshift_master_etcd_urls: "{{ openshift_master_etcd_hosts | lib_utils_oo_etcd_host_urls(l_use_ssl, openshift_master_etcd_port) }}"
  83. vars:
  84. l_use_ssl: "{{ openshift_master_etcd_use_ssl | default(True) | bool}}"
  85. - import_role:
  86. name: openshift_control_plane
  87. tasks_from: update_etcd_client_urls.yml