You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.4 KiB

  1. ---
  2. - set_fact: etcd_address="{{ ip | default(ansible_default_ipv4['address']) }}"
  3. - set_fact: etcd_access_address="{{ access_ip | default(etcd_address) }}"
  4. - set_fact: etcd_peer_url="http://{{ etcd_access_address }}:2380"
  5. - set_fact: etcd_client_url="http://{{ etcd_access_address }}:2379"
  6. - set_fact: etcd_authority="{{ access_ip|default('127.0.0.1') }}:2379"
  7. - set_fact: etcd_endpoint="http://{{ etcd_authority }}"
  8. - set_fact:
  9. etcd_access_addresses: |-
  10. {% for item in groups['etcd'] -%}
  11. http://{{ hostvars[item].etcd_access_address }}:2379{% if not loop.last %},{% endif %}
  12. {%- endfor %}
  13. - set_fact: etcd_access_endpoint="{% if etcd_multiaccess %}{{ etcd_access_addresses }}{% else %}{{ etcd_endpoint }}{% endif %}"
  14. - set_fact:
  15. etcd_member_name: |-
  16. {% for host in groups['etcd'] %}
  17. {% if inventory_hostname == host %}{{"etcd"+loop.index|string }}{% endif %}
  18. {% endfor %}
  19. - set_fact:
  20. etcd_proxy_member_name: |-
  21. {% for host in groups['k8s-cluster'] %}
  22. {% if inventory_hostname == host %}{{"etcd-proxy"+loop.index|string }}{% endif %}
  23. {% endfor %}
  24. - set_fact:
  25. is_etcd_proxy: "{{ inventory_hostname in groups['k8s-cluster'] }}"
  26. - set_fact:
  27. is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"
  28. - set_fact:
  29. etcd_after_v3: etcd_version | version_compare("v3.0.0", ">=")
  30. - set_fact:
  31. etcd_container_bin_dir: "{% if etcd_after_v3 %}/usr/local/bin/{% else %}/{% endif %}"