scaleup.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. roles:
  27. - role: openshift_etcd
  28. when: etcd_add_check.rc == 0
  29. etcd_peers: "{{ groups.oo_etcd_to_config | union(groups.oo_new_etcd_to_config)| default([], true) }}"
  30. etcd_ca_host: "{{ groups.oo_etcd_to_config.0 }}"
  31. etcd_certificates_etcd_hosts: "{{ groups.oo_etcd_to_config | default([], true) }}"
  32. etcd_initial_cluster_state: "existing"
  33. initial_etcd_cluster: "{{ etcd_add_check.stdout_lines[3] | regex_replace('ETCD_INITIAL_CLUSTER=','') }}"
  34. etcd_ca_setup: False
  35. r_etcd_common_etcd_runtime: "{{ openshift.common.etcd_runtime }}"
  36. - role: nickhammond.logrotate
  37. when: etcd_add_check.rc == 0