Add etcd group support to rke role

Etcd cluster is now placed in members of kubernetes-etcd group instead
of kubernetes-node.
Due to defaults, it means infra is the only etcd
by default.

Change-Id: Iae05a42442849e4a248d73c2d78f5e2b0eae7255
Issue-ID: OOM-1778
Signed-off-by: Michal Zegan <m.zegan@samsung.com>
diff --git a/ansible/roles/rke/molecule/default/molecule.yml b/ansible/roles/rke/molecule/default/molecule.yml
index 444a751..6ae613a 100644
--- a/ansible/roles/rke/molecule/default/molecule.yml
+++ b/ansible/roles/rke/molecule/default/molecule.yml
@@ -19,6 +19,7 @@
       container: docker
     groups:
       - infrastructure
+      - kubernetes-etcd
       - kubernetes-control-plane
       - kubernetes
     networks:
diff --git a/ansible/roles/rke/molecule/default/tests/test_etcd.py b/ansible/roles/rke/molecule/default/tests/test_etcd.py
new file mode 100644
index 0000000..0f4b6f1
--- /dev/null
+++ b/ansible/roles/rke/molecule/default/tests/test_etcd.py
@@ -0,0 +1,13 @@
+import os
+import pytest
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('kubernetes-etcd')
+
+
+@pytest.mark.parametrize('container_name', [
+  'etcd'])
+def test_container_running(host, container_name):
+    assert host.docker(container_name).is_running
diff --git a/ansible/roles/rke/molecule/default/tests/test_nodes.py b/ansible/roles/rke/molecule/default/tests/test_nodes.py
index fcc5e7e..6041301 100644
--- a/ansible/roles/rke/molecule/default/tests/test_nodes.py
+++ b/ansible/roles/rke/molecule/default/tests/test_nodes.py
@@ -8,6 +8,6 @@
 
 
 @pytest.mark.parametrize('container_name', [
-  'etcd', 'kubelet', 'kube-proxy'])
+  'kubelet', 'kube-proxy'])
 def test_container_running(host, container_name):
     assert host.docker(container_name).is_running
diff --git a/ansible/roles/rke/templates/cluster.yml.j2 b/ansible/roles/rke/templates/cluster.yml.j2
index f28cff8..2012ab9 100644
--- a/ansible/roles/rke/templates/cluster.yml.j2
+++ b/ansible/roles/rke/templates/cluster.yml.j2
@@ -9,6 +9,8 @@
 {% endif %}
 {% if node in groups['kubernetes-node'] %}
   - worker
+{% endif %}
+{% if node in groups['kubernetes-etcd'] %}
   - etcd
 {% endif %}
   hostname_override: ""