scaleup.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. roles:
  17. - role: os_firewall
  18. when: etcd_add_check.rc == 0
  19. - role: openshift_etcd
  20. when: etcd_add_check.rc == 0
  21. etcd_peers: "{{ groups.oo_etcd_to_config | union(groups.oo_new_etcd_to_config)| default([], true) }}"
  22. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  23. etcd_initial_cluster_state: "existing"
  24. etcd_initial_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') | regex_replace('\"','') }}"
  25. etcd_ca_setup: False
  26. - role: nickhammond.logrotate
  27. when: etcd_add_check.rc == 0
  28. post_tasks:
  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. vars:
  46. openshift_master_etcd_hosts: "{{ hostvars
  47. | lib_utils_oo_select_keys(groups['oo_etcd_to_config'] | union(groups['oo_new_etcd_to_config'] | default([]) ))
  48. | lib_utils_oo_collect('openshift.common.hostname')
  49. | default(none, true) }}"
  50. openshift_master_etcd_port: "{{ (etcd_client_port | default('2379')) if (groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config) else none }}"
  51. roles:
  52. - role: openshift_master_facts
  53. post_tasks:
  54. - import_role:
  55. name: openshift_master
  56. tasks_from: update_etcd_client_urls.yml