Merge "Always extract etcd archive"
diff --git a/.kitchen.yml b/.kitchen.yml
index 014215d..a599adf 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -37,16 +37,10 @@
sudo: true
docker_images:
- - &xenial-20163 <%=ENV['IMAGE_XENIAL_20163'] || 'docker-dev-local.docker.mirantis.net/epcim/salt/saltstack-ubuntu-xenial-salt-2016.3/salt:2018_11_19'%>
- &xenial-20177 <%=ENV['IMAGE_XENIAL_20177'] || 'docker-dev-local.docker.mirantis.net/epcim/salt/saltstack-ubuntu-xenial-salt-2017.7/salt:2018_11_19'%>
- &xenial-stable <%=ENV['IMAGE_XENIAL_STABLE'] || 'docker-dev-local.docker.mirantis.net/epcim/salt/saltstack-ubuntu-xenial-salt-stable/salt:2018_11_19'%>
platforms:
- - name: xenial-2016.3
- driver_config:
- image: *xenial-20163
- platform: ubuntu
-
- name: xenial-2017.7
driver_config:
image: *xenial-20177
diff --git a/etcd/files/configenvv3 b/etcd/files/configenvv3
new file mode 100644
index 0000000..9f1811b
--- /dev/null
+++ b/etcd/files/configenvv3
@@ -0,0 +1,9 @@
+{%- from "etcd/map.jinja" import server with context %}
+# this file can be sourced and used to configure etcdctl
+export ETCDCTL_API=3
+export ETCDCTL_ENDPOINTS=["{% for member in server.members %}http{% if server.get('ssl', {}).get('enabled') %}s{% endif %}://{{ member.host }}:4001{% if not loop.last %},{% endif %}{% endfor %}"]
+{%- if server.get('ssl', {}).get('enabled') %}
+export ETCDCTL_CACERT=/var/lib/etcd/ca.pem
+export ETCDCTL_CERT=/var/lib/etcd/etcd-server.pem
+export ETCDCTL_KEY=/var/lib/etcd/etcd-server.key
+{% endif %}
diff --git a/etcd/server/service.sls b/etcd/server/service.sls
index 6b0b55f..3c2e23a 100644
--- a/etcd/server/service.sls
+++ b/etcd/server/service.sls
@@ -187,6 +187,14 @@
- require:
- file: /var/lib/etcd/
+/var/lib/etcd/configenvv3:
+ file.managed:
+ - source: salt://etcd/files/configenvv3
+ - template: jinja
+ - user: etcd
+ - require:
+ - file: /var/lib/etcd/
+
etcd:
service.running:
- enable: True