scaleup.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: openshift_etcd
  31. when: etcd_add_check.rc == 0
  32. etcd_peers: "{{ groups.oo_etcd_to_config | union(groups.oo_new_etcd_to_config)| default([], true) }}"
  33. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  34. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  35. etcd_initial_cluster_state: "existing"
  36. initial_etcd_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') }}"
  37. etcd_ca_setup: False
  38. r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"
  39. - role: nickhammond.logrotate
  40. when: etcd_add_check.rc == 0
  41. post_tasks:
  42. - name: Verify cluster is stable
  43. command: >
  44. /usr/bin/etcdctl --cert-file {{ etcd_peer_cert_file }}
  45. --key-file {{ etcd_peer_key_file }}
  46. --ca-file {{ etcd_peer_ca_file }}
  47. -C {{ etcd_peer_url_scheme }}://{{ hostvars[etcd_ca_host].etcd_hostname }}:{{ etcd_client_port }}
  48. cluster-health
  49. retries: 1
  50. delay: 30