scaleup.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. - name: Gather facts
  3. hosts: oo_etcd_to_config:oo_new_etcd_to_config
  4. roles:
  5. - openshift_etcd_facts
  6. post_tasks:
  7. - set_fact:
  8. etcd_hostname: "{{ etcd_hostname }}"
  9. etcd_ip: "{{ etcd_ip }}"
  10. - name: Configure etcd
  11. hosts: oo_new_etcd_to_config
  12. serial: 1
  13. any_errors_fatal: true
  14. vars:
  15. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  16. pre_tasks:
  17. - name: Add new etcd members to cluster
  18. command: >
  19. /usr/bin/etcdctl --cert-file {{ etcd_peer_cert_file }}
  20. --key-file {{ etcd_peer_key_file }}
  21. --ca-file {{ etcd_peer_ca_file }}
  22. -C {{ etcd_peer_url_scheme }}://{{ hostvars[etcd_ca_host].etcd_hostname }}:{{ etcd_client_port }}
  23. member add {{ etcd_hostname }} {{ etcd_peer_url_scheme }}://{{ etcd_ip }}:{{ etcd_peer_port }}
  24. delegate_to: "{{ etcd_ca_host }}"
  25. register: etcd_add_check
  26. retries: 3
  27. delay: 10
  28. until: etcd_add_check.rc == 0
  29. roles:
  30. - role: os_firewall
  31. when: etcd_add_check.rc == 0
  32. - role: openshift_etcd
  33. when: etcd_add_check.rc == 0
  34. etcd_peers: "{{ groups.oo_etcd_to_config | union(groups.oo_new_etcd_to_config)| default([], true) }}"
  35. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  36. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  37. etcd_initial_cluster_state: "existing"
  38. initial_etcd_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') | regex_replace('\"','') }}"
  39. etcd_ca_setup: False
  40. r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"
  41. - role: nickhammond.logrotate
  42. when: etcd_add_check.rc == 0
  43. post_tasks:
  44. - name: Verify cluster is stable
  45. command: >
  46. /usr/bin/etcdctl --cert-file {{ etcd_peer_cert_file }}
  47. --key-file {{ etcd_peer_key_file }}
  48. --ca-file {{ etcd_peer_ca_file }}
  49. -C {{ etcd_peer_url_scheme }}://{{ hostvars[etcd_ca_host].etcd_hostname }}:{{ etcd_client_port }}
  50. cluster-health
  51. register: scaleup_health
  52. retries: 3
  53. delay: 30
  54. until: scaleup_health.rc == 0