Fix sl and manila

Change-Id: Ic0e57d922d8acb87dfe95471cc18c5e86c0a8b46
diff --git a/tcp_tests/templates/cookied-mcp-queens-dvr/_context-cookiecutter-mcp-queens-dvr.yaml b/tcp_tests/templates/cookied-mcp-queens-dvr/_context-cookiecutter-mcp-queens-dvr.yaml
index 2dc0a2c..ffc9bab 100644
--- a/tcp_tests/templates/cookied-mcp-queens-dvr/_context-cookiecutter-mcp-queens-dvr.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-dvr/_context-cookiecutter-mcp-queens-dvr.yaml
@@ -208,4 +208,15 @@
   manila_enabled: 'True'
   manila_share_backend: 'lvm'
   manila_lvm_volume_name: 'manila-volume'
-  manila_lvm_devices: '/dev/loop1'
\ No newline at end of file
+  manila_lvm_devices: '/dev/loop1'
+  openstack_share_address: 172.16.10.68
+  openstack_share_node01_address: 172.16.10.69
+  openstack_share_node02_address: 172.16.10.70
+  openstack_share_node03_address: 172.16.10.71
+  openstack_share_node01_deploy_address: 192.168.10.69
+  openstack_share_node02_deploy_address: 192.168.10.70
+  openstack_share_node03_deploy_address: 192.168.10.71
+  openstack_share_hostname: share
+  openstack_share_node01_hostname: share01
+  openstack_share_node02_hostname: share02
+  openstack_share_node03_hostname: share03
\ No newline at end of file
diff --git a/tcp_tests/templates/cookied-mcp-queens-dvr/_context-environment.yaml b/tcp_tests/templates/cookied-mcp-queens-dvr/_context-environment.yaml
index 0deff14..14a228d 100644
--- a/tcp_tests/templates/cookied-mcp-queens-dvr/_context-environment.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-dvr/_context-environment.yaml
@@ -18,6 +18,7 @@
       - openstack_database_leader
       - openstack_message_queue
       - linux_system_codename_xenial
+      - openstack_dns
       interfaces:
         ens3:
           role: single_dhcp
@@ -32,6 +33,7 @@
       - openstack_database
       - openstack_message_queue
       - linux_system_codename_xenial
+      - openstack_dns
       interfaces:
         ens3:
           role: single_dhcp
@@ -46,6 +48,7 @@
       - openstack_database
       - openstack_message_queue
       - linux_system_codename_xenial
+      - openstack_dns
       interfaces:
         ens3:
           role: single_dhcp
@@ -202,4 +205,26 @@
         ens3:
           role: single_dhcp
         ens4:
+          role: single_ctl
+
+    share02.mcp-queens-dvr.local:
+      reclass_storage_name: openstack_share_node02
+      roles:
+      - openstack_share
+      - linux_system_codename_xenial
+      interfaces:
+        ens3:
+          role: single_dhcp
+        ens4:
+          role: single_ctl
+
+    share03.mcp-queens-dvr.local:
+      reclass_storage_name: openstack_share_node03
+      roles:
+      - openstack_share
+      - linux_system_codename_xenial
+      interfaces:
+        ens3:
+          role: single_dhcp
+        ens4:
           role: single_ctl
\ No newline at end of file
diff --git a/tcp_tests/templates/cookied-mcp-queens-dvr/salt.yaml b/tcp_tests/templates/cookied-mcp-queens-dvr/salt.yaml
index 4b04af1..8c922d2 100644
--- a/tcp_tests/templates/cookied-mcp-queens-dvr/salt.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-dvr/salt.yaml
@@ -15,6 +15,7 @@
 {{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
 
 {{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }}
+
 {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
 
 {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
diff --git a/tcp_tests/templates/cookied-mcp-queens-dvr/sl.yaml b/tcp_tests/templates/cookied-mcp-queens-dvr/sl.yaml
index 6cc9fd3..c8875a4 100644
--- a/tcp_tests/templates/cookied-mcp-queens-dvr/sl.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-dvr/sl.yaml
@@ -5,22 +5,22 @@
 
 {{  SHARED_SL.MACRO_INSTALL_DOCKER_SWARM() }}
 
+{{  SHARED_SL.MACRO_INSTALL_GLUSTERFS_CLIENT() }}
+
 {{  SHARED_SL.MACRO_INSTALL_MONGODB() }}
 
 {{  SHARED_SL.MACRO_INSTALL_MONGODB_CLUSTER() }}
 
-{{  SHARED_SL.MACRO_INSTALL_PROMETEUS() }}
+{{  SHARED_SL.MACRO_INSTALL_TELEGRAF_AND_PROMETHEUS() }}
+
+{{  SHARED_SL.MACRO_INSTALL_ELASTICSEARCH_AND_KIBANA() }}
 
 {{  SHARED_SL.MACRO_INSTALL_LOG_COLLECTION() }}
 
 {{  SHARED_SL.MACRO_INSTALL_CEILOMETER_COLLECTOR() }}
 
-{{  SHARED_SL.MACRO_COLLECT_GRAINS() }}
-
 {{  SHARED_SL.MACRO_CONFIGURE_SERVICES() }}
 
-{{  SHARED_SL.MACRO_LAUNCH_CONTAINERS() }}
-
 {{  SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
 
 {{  SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}
diff --git a/tcp_tests/templates/cookied-mcp-queens-dvr/underlay.yaml b/tcp_tests/templates/cookied-mcp-queens-dvr/underlay.yaml
index f8c13d4..fe77dbe 100644
--- a/tcp_tests/templates/cookied-mcp-queens-dvr/underlay.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-dvr/underlay.yaml
@@ -32,6 +32,8 @@
 {% set HOSTNAME_GTW01 = os_env('HOSTNAME_GTW01', 'gtw01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_PRX01 = os_env('HOSTNAME_PRX01', 'prx01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_SHARE01 = os_env('HOSTNAME_SHARE01', 'share01.' + DOMAIN_NAME) %}
+{% set HOSTNAME_SHARE02 = os_env('HOSTNAME_SHARE01', 'share02.' + DOMAIN_NAME) %}
+{% set HOSTNAME_SHARE03 = os_env('HOSTNAME_SHARE01', 'share03.' + DOMAIN_NAME) %}
 
 template:
   devops_settings:
@@ -61,7 +63,9 @@
             default_{{ HOSTNAME_MTR03 }}: +88
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+90, -10]
 
@@ -88,7 +92,9 @@
             default_{{ HOSTNAME_MTR03 }}: +88
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+90, -10]
 
@@ -115,7 +121,9 @@
             default_{{ HOSTNAME_MTR03 }}: +88
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+10, -10]
 
@@ -142,7 +150,9 @@
             default_{{ HOSTNAME_MTR03 }}: +88
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+130, +220]
 
@@ -731,3 +741,55 @@
 
               interfaces: *all_interfaces
               network_config: *all_network_config
+
+          - name: {{ HOSTNAME_SHARE02 }}
+            role: salt_minion
+            params:
+              vcpu: !os_env SLAVE_NODE_CPU, 2
+              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              boot:
+                - hd
+              cloud_init_volume_name: iso
+              cloud_init_iface_up: ens3
+              volumes:
+                - name: system
+                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  backing_store: mcp_ubuntu_1604_image
+                  format: qcow2
+                - name: iso  # Volume with name 'iso' will be used
+                             # for store image with cloud-init metadata.
+                  capacity: 1
+                  format: raw
+                  device: cdrom
+                  bus: ide
+                  cloudinit_meta_data: *cloudinit_meta_data
+                  cloudinit_user_data: *cloudinit_user_data_1604
+
+              interfaces: *all_interfaces
+              network_config: *all_network_config
+
+          - name: {{ HOSTNAME_SHARE03 }}
+            role: salt_minion
+            params:
+              vcpu: !os_env SLAVE_NODE_CPU, 2
+              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              boot:
+                - hd
+              cloud_init_volume_name: iso
+              cloud_init_iface_up: ens3
+              volumes:
+                - name: system
+                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  backing_store: mcp_ubuntu_1604_image
+                  format: qcow2
+                - name: iso  # Volume with name 'iso' will be used
+                             # for store image with cloud-init metadata.
+                  capacity: 1
+                  format: raw
+                  device: cdrom
+                  bus: ide
+                  cloudinit_meta_data: *cloudinit_meta_data
+                  cloudinit_user_data: *cloudinit_user_data_1604
+
+              interfaces: *all_interfaces
+              network_config: *all_network_config
diff --git a/tcp_tests/templates/cookied-mcp-queens-ovs/_context-cookiecutter-mcp-queens-ovs.yaml b/tcp_tests/templates/cookied-mcp-queens-ovs/_context-cookiecutter-mcp-queens-ovs.yaml
index d8f2505..3da02ff 100644
--- a/tcp_tests/templates/cookied-mcp-queens-ovs/_context-cookiecutter-mcp-queens-ovs.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-ovs/_context-cookiecutter-mcp-queens-ovs.yaml
@@ -209,3 +209,14 @@
   manila_share_backend: 'lvm'
   manila_lvm_volume_name: 'manila-volume'
   manila_lvm_devices: '/dev/loop1'
+  openstack_share_address: 172.16.10.68
+  openstack_share_node01_address: 172.16.10.69
+  openstack_share_node02_address: 172.16.10.70
+  openstack_share_node03_address: 172.16.10.71
+  openstack_share_node01_deploy_address: 192.168.10.69
+  openstack_share_node02_deploy_address: 192.168.10.70
+  openstack_share_node03_deploy_address: 192.168.10.71
+  openstack_share_hostname: share
+  openstack_share_node01_hostname: share01
+  openstack_share_node02_hostname: share02
+  openstack_share_node03_hostname: share03
diff --git a/tcp_tests/templates/cookied-mcp-queens-ovs/_context-environment.yaml b/tcp_tests/templates/cookied-mcp-queens-ovs/_context-environment.yaml
index 6230f55..2be8edf 100644
--- a/tcp_tests/templates/cookied-mcp-queens-ovs/_context-environment.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-ovs/_context-environment.yaml
@@ -224,4 +224,26 @@
         ens3:
           role: single_dhcp
         ens4:
+          role: single_ctl
+
+    share02.mcp-queens-ovs.local:
+      reclass_storage_name: openstack_share_node02
+      roles:
+      - openstack_share
+      - linux_system_codename_xenial
+      interfaces:
+        ens3:
+          role: single_dhcp
+        ens4:
+          role: single_ctl
+
+    share03.mcp-queens-ovs.local:
+      reclass_storage_name: openstack_share_node03
+      roles:
+      - openstack_share
+      - linux_system_codename_xenial
+      interfaces:
+        ens3:
+          role: single_dhcp
+        ens4:
           role: single_ctl
\ No newline at end of file
diff --git a/tcp_tests/templates/cookied-mcp-queens-ovs/salt.yaml b/tcp_tests/templates/cookied-mcp-queens-ovs/salt.yaml
index e88d8a4..1e102d5 100644
--- a/tcp_tests/templates/cookied-mcp-queens-ovs/salt.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-ovs/salt.yaml
@@ -15,6 +15,7 @@
 {{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
 
 {{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='\*') }}
+
 {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
 
 {{ SHARED.MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() }}
diff --git a/tcp_tests/templates/cookied-mcp-queens-ovs/sl.yaml b/tcp_tests/templates/cookied-mcp-queens-ovs/sl.yaml
index 587cb1e..07eb3af 100644
--- a/tcp_tests/templates/cookied-mcp-queens-ovs/sl.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-ovs/sl.yaml
@@ -5,22 +5,22 @@
 
 {{  SHARED_SL.MACRO_INSTALL_DOCKER_SWARM() }}
 
+{{  SHARED_SL.MACRO_INSTALL_GLUSTERFS_CLIENT() }}
+
 {{  SHARED_SL.MACRO_INSTALL_MONGODB() }}
 
 {{  SHARED_SL.MACRO_INSTALL_MONGODB_CLUSTER() }}
 
-{{  SHARED_SL.MACRO_INSTALL_PROMETEUS() }}
+{{  SHARED_SL.MACRO_INSTALL_TELEGRAF_AND_PROMETHEUS() }}
+
+{{  SHARED_SL.MACRO_INSTALL_ELASTICSEARCH_AND_KIBANA() }}
 
 {{  SHARED_SL.MACRO_INSTALL_LOG_COLLECTION() }}
 
 {{  SHARED_SL.MACRO_INSTALL_CEILOMETER_COLLECTOR() }}
 
-{{  SHARED_SL.MACRO_COLLECT_GRAINS() }}
-
 {{  SHARED_SL.MACRO_CONFIGURE_SERVICES() }}
 
-{{  SHARED_SL.MACRO_LAUNCH_CONTAINERS() }}
-
 {{  SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }}
 
 {{  SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }}
diff --git a/tcp_tests/templates/cookied-mcp-queens-ovs/underlay.yaml b/tcp_tests/templates/cookied-mcp-queens-ovs/underlay.yaml
index 0b7b0e8..ac187d1 100644
--- a/tcp_tests/templates/cookied-mcp-queens-ovs/underlay.yaml
+++ b/tcp_tests/templates/cookied-mcp-queens-ovs/underlay.yaml
@@ -34,7 +34,8 @@
 {% set HOSTNAME_DNS02 = os_env('HOSTNAME_DNS02', 'dns02.' + DOMAIN_NAME) %}
 {% set HOSTNAME_PRX01 = os_env('HOSTNAME_PRX01', 'prx01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_SHARE01 = os_env('HOSTNAME_SHARE01', 'share01.' + DOMAIN_NAME) %}
-
+{% set HOSTNAME_SHARE02 = os_env('HOSTNAME_SHARE01', 'share02.' + DOMAIN_NAME) %}
+{% set HOSTNAME_SHARE03 = os_env('HOSTNAME_SHARE01', 'share03.' + DOMAIN_NAME) %}
 template:
   devops_settings:
     env_name: {{ os_env('ENV_NAME', 'cookied-mcp-queens-ovs_' + REPOSITORY_SUITE + "_" + os_env('BUILD_NUMBER', '')) }}
@@ -65,7 +66,9 @@
             default_{{ HOSTNAME_DNS01 }}: +111
             default_{{ HOSTNAME_DNS02 }}: +112
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+90, -10]
 
@@ -94,7 +97,9 @@
             default_{{ HOSTNAME_DNS01 }}: +111
             default_{{ HOSTNAME_DNS02 }}: +112
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+90, -10]
 
@@ -123,7 +128,9 @@
             default_{{ HOSTNAME_DNS01 }}: +111
             default_{{ HOSTNAME_DNS02 }}: +112
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+10, -10]
 
@@ -152,7 +159,9 @@
             default_{{ HOSTNAME_DNS01 }}: +111
             default_{{ HOSTNAME_DNS02 }}: +112
             default_{{ HOSTNAME_PRX01 }}: +121
-            default_{{ HOSTNAME_SHARE01 }}: +130
+            default_{{ HOSTNAME_SHARE01 }}: +69
+            default_{{ HOSTNAME_SHARE02 }}: +70
+            default_{{ HOSTNAME_SHARE03 }}: +71
           ip_ranges:
             dhcp: [+130, +220]
 
@@ -792,3 +801,55 @@
 
               interfaces: *all_interfaces
               network_config: *all_network_config
+
+          - name: {{ HOSTNAME_SHARE02 }}
+            role: salt_minion
+            params:
+              vcpu: !os_env SLAVE_NODE_CPU, 2
+              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              boot:
+                - hd
+              cloud_init_volume_name: iso
+              cloud_init_iface_up: ens3
+              volumes:
+                - name: system
+                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  backing_store: mcp_ubuntu_1604_image
+                  format: qcow2
+                - name: iso  # Volume with name 'iso' will be used
+                             # for store image with cloud-init metadata.
+                  capacity: 1
+                  format: raw
+                  device: cdrom
+                  bus: ide
+                  cloudinit_meta_data: *cloudinit_meta_data
+                  cloudinit_user_data: *cloudinit_user_data_1604
+
+              interfaces: *all_interfaces
+              network_config: *all_network_config
+
+          - name: {{ HOSTNAME_SHARE03 }}
+            role: salt_minion
+            params:
+              vcpu: !os_env SLAVE_NODE_CPU, 2
+              memory: !os_env SLAVE_NODE_MEMORY, 4096
+              boot:
+                - hd
+              cloud_init_volume_name: iso
+              cloud_init_iface_up: ens3
+              volumes:
+                - name: system
+                  capacity: !os_env NODE_VOLUME_SIZE, 150
+                  backing_store: mcp_ubuntu_1604_image
+                  format: qcow2
+                - name: iso  # Volume with name 'iso' will be used
+                             # for store image with cloud-init metadata.
+                  capacity: 1
+                  format: raw
+                  device: cdrom
+                  bus: ide
+                  cloudinit_meta_data: *cloudinit_meta_data
+                  cloudinit_user_data: *cloudinit_user_data_1604
+
+              interfaces: *all_interfaces
+              network_config: *all_network_config
diff --git a/tcp_tests/templates/shared-openstack.yaml b/tcp_tests/templates/shared-openstack.yaml
index cec31ae..fb326d0 100644
--- a/tcp_tests/templates/shared-openstack.yaml
+++ b/tcp_tests/templates/shared-openstack.yaml
@@ -322,13 +322,6 @@
   retry: {count: 1, delay: 5}
   skip_fail: false
 
-- description: WR https://mirantis.jira.com/browse/PROD-19012
-  cmd: |
-    salt 'ctl*' cmd.run 'systemctl restart apache2'
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 5}
-  skip_fail: false
-
 - description: Check manila-services
   cmd: |
     salt 'ctl01*' cmd.run '. /root/keystonercv3; manila service-list'
@@ -338,7 +331,7 @@
 
 - description: Create manila type
   cmd: |
-    salt 'cfg01*' state.sls manila.client
+    salt -C "I@manila:client" state.sls manila.client
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
   skip_fail: false
diff --git a/tcp_tests/templates/shared-sl.yaml b/tcp_tests/templates/shared-sl.yaml
index d41d1c1..413162b 100644
--- a/tcp_tests/templates/shared-sl.yaml
+++ b/tcp_tests/templates/shared-sl.yaml
@@ -67,6 +67,15 @@
   skip_fail: false
 {%- endmacro %}
 
+{%- macro MACRO_INSTALL_GLUSTERFS_CLIENT() %}
+- description: Install glusterfs client
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False
+    -C 'I@glusterfs:client' state.sls glusterfs.client
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 2, delay: 15}
+  skip_fail: false
+{%- endmacro %}
+
 {%- macro MACRO_INSTALL_MONGODB() %}
 # Install slv2 infra
 # Install MongoDB for alerta
@@ -90,7 +99,9 @@
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 5, delay: 20}
   skip_fail: false
+{%- endmacro %}
 
+{%- macro MACRO_INSTALL_TELEGRAF_AND_PROMETHEUS() %}
 - description: Install telegraf
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
   node_name: {{ HOSTNAME_CFG01 }}
@@ -105,21 +116,35 @@
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
   skip_fail: false
+{%- endmacro %}
+
+{%- macro MACRO_INSTALL_ELASTICSEARCH_AND_KIBANA() %}
+- description: Install elasticsearch server
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true and *01*' state.sls elasticsearch.server
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 10}
+  skip_fail: false
 
 - description: Install elasticsearch server
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true' state.sls elasticsearch.server
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
   skip_fail: false
 
 - description: Install kibana server
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true and *01*' state.sls kibana.server
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 10}
+  skip_fail: false
+
+- description: Install kibana server
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true' state.sls kibana.server
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
   skip_fail: false
 
 - description: Install elasticsearch client
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
+  cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 2, delay: 30}
   skip_fail: false
@@ -135,25 +160,12 @@
     INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
     echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
     if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
-        salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
+        salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server and *01*' state.sls influxdb;
+        salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb;
     fi
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
-  skip_fail: true
-{%- endmacro %}
-
-{%- macro MACRO_INSTALL_PROMETEUS() %}
-# Install Prometheus LTS(optional if set in model)
-- description: Prometheus LTS(optional if set in model)
-  cmd: |
-    PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`;
-    echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}";
-    if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then
-        salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus
-    fi
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 5}
-  skip_fail: true
+  skip_fail: false
 {%- endmacro %}
 
 {%- macro MACRO_INSTALL_LOG_COLLECTION() %}
@@ -187,39 +199,29 @@
   skip_fail: false
 {%- endmacro %}
 
-{%- macro MACRO_COLLECT_GRAINS() %}
-# Collect grains needed to configure the services
-
-- description: Get grains
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: Sync modules
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: Update mine
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 5, delay: 15}
-  skip_fail: false
-{%- endmacro %}
-
 {%- macro MACRO_CONFIGURE_SERVICES() %}
-# Configure the services running in Docker Swarm
-- description: Configure prometheus in docker swarm
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus,heka.remote_collector
+# Collect grains needed to configure the services
+- description: Collect Grains
+  cmd: |
+    salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains;
+    salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules;
+    salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
   skip_fail: false
-{%- endmacro %}
 
-{%- macro MACRO_LAUNCH_CONTAINERS() %}
-# Launch containers
+- description: Check docker ps
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 2, delay: 10}
+  skip_fail: false
+
+- description: Configure Remote Collector in Docker Swarm for Openstack deployments
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 10}
+  skip_fail: false
+
 - description: launch prometheus containers
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client
   node_name: {{ HOSTNAME_CFG01 }}
@@ -229,24 +231,43 @@
 - description: Check docker ps
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps"
   node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 2, delay: 10}
-  skip_fail: false
-
-- description: Install sphinx
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx
-  node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
   skip_fail: false
 
-- description: Configure Grafana dashboards and datasources
-  cmd: sleep 30;  salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
+- description: "check grafana service"
+  cmd: timeout 60 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:server' cmd.run
+      'export SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
+       curl -sf http://${SL_VIP}:15013/;'
   node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 2, delay: 10}
+  retry: {count: 1, delay: 10}
+  skip_fail: true
+
+- description: Configure Grafana dashboards and datasources
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 5, delay: 60}
+  skip_fail: false
+
+- description: "check grafana service"
+  cmd: timeout 60 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:server' cmd.run
+      'export SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
+       curl -sf http://${SL_VIP}:15013/;'
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 10}
+  skip_fail: true
+
+- description: Configure Alerta if it is exists
+  cmd: |
+    if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:alerta' match.pillar 'prometheus:alerta' ; then
+      salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:alerta' state.sls prometheus.alerta
+    fi
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 10}
   skip_fail: false
 
 - description: Run salt minion to create cert files
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
+  cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion.cert
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
-  skip_fail: false
-{%- endmacro %}
\ No newline at end of file
+  skip_fail: true
+{%- endmacro %}