etcd.conf.j2 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {% macro initial_cluster() -%}
  2. {% for host in etcd_peers | default([]) -%}
  3. {% if loop.last -%}
  4. {{ hostvars[host].etcd_hostname }}={{ etcd_peer_url_scheme }}://{{ hostvars[host].etcd_ip }}:{{ etcd_peer_port }}
  5. {%- else -%}
  6. {{ hostvars[host].etcd_hostname }}={{ etcd_peer_url_scheme }}://{{ hostvars[host].etcd_ip }}:{{ etcd_peer_port }},
  7. {%- endif -%}
  8. {% endfor -%}
  9. {% endmacro -%}
  10. {% if (etcd_peers | default([]) | length > 1) or (etcd_is_thirdparty) %}
  11. ETCD_NAME={{ etcd_hostname }}
  12. ETCD_LISTEN_PEER_URLS={{ etcd_listen_peer_urls }}
  13. {% else %}
  14. ETCD_NAME=default
  15. {% endif %}
  16. ETCD_DATA_DIR={{ etcd_data_dir }}
  17. #ETCD_SNAPSHOT_COUNTER=10000
  18. ETCD_HEARTBEAT_INTERVAL=500
  19. ETCD_ELECTION_TIMEOUT=2500
  20. ETCD_LISTEN_CLIENT_URLS={{ etcd_listen_client_urls }}
  21. #ETCD_MAX_SNAPSHOTS=5
  22. #ETCD_MAX_WALS=5
  23. #ETCD_CORS=
  24. {% if etcd_is_thirdparty %}
  25. #[cluster]
  26. ETCD_INITIAL_ADVERTISE_PEER_URLS={{ etcd_initial_advertise_peer_urls }}
  27. # TODO: This needs to be altered to support the correct etcd instances
  28. ETCD_INITIAL_CLUSTER={{ etcd_hostname}}={{ etcd_initial_advertise_peer_urls }}
  29. ETCD_INITIAL_CLUSTER_STATE={{ etcd_initial_cluster_state }}
  30. ETCD_INITIAL_CLUSTER_TOKEN=thirdparty-etcd-cluster-1
  31. {% endif %}
  32. {% if etcd_peers | default([]) | length > 1 %}
  33. #[cluster]
  34. ETCD_INITIAL_ADVERTISE_PEER_URLS={{ etcd_initial_advertise_peer_urls }}
  35. ETCD_INITIAL_CLUSTER={{ initial_cluster() }}
  36. ETCD_INITIAL_CLUSTER_STATE={{ etcd_initial_cluster_state }}
  37. ETCD_INITIAL_CLUSTER_TOKEN={{ etcd_initial_cluster_token }}
  38. #ETCD_DISCOVERY=
  39. #ETCD_DISCOVERY_SRV=
  40. #ETCD_DISCOVERY_FALLBACK=proxy
  41. #ETCD_DISCOVERY_PROXY=
  42. {% endif %}
  43. ETCD_ADVERTISE_CLIENT_URLS={{ etcd_advertise_client_urls }}
  44. #[proxy]
  45. #ETCD_PROXY=off
  46. #[security]
  47. {% if etcd_url_scheme == 'https' -%}
  48. ETCD_CA_FILE={{ etcd_ca_file }}
  49. ETCD_CERT_FILE={{ etcd_cert_file }}
  50. ETCD_KEY_FILE={{ etcd_key_file }}
  51. {% endif -%}
  52. {% if etcd_peer_url_scheme == 'https' -%}
  53. ETCD_PEER_CA_FILE={{ etcd_peer_ca_file }}
  54. ETCD_PEER_CERT_FILE={{ etcd_peer_cert_file }}
  55. ETCD_PEER_KEY_FILE={{ etcd_peer_key_file }}
  56. {% endif -%}