blob: d900c42fb68fef632b2ca0391310c39858509015 [file] [log] [blame]
{% from 'virtual-mcp11-k8s-calico/underlay.yaml' import HOSTNAME_CFG01 with context %}
# Install docker swarm
- description: Configure docker service
cmd: salt -C 'I@docker:swarm' state.sls docker.host
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Install docker swarm on master node
cmd: salt -C 'I@docker:swarm:role:master' state.sls docker.swarm
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Send grains to the swarm slave nodes
cmd: salt -C 'I@docker:swarm' state.sls salt.minion.grains
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Update mine
cmd: salt -C 'I@docker:swarm' mine.update
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Refresh modules
cmd: salt -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Configure slave nodes
cmd: salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: List registered Docker swarm nodes
cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
# Install slv2 infra
- description: Install telegraf
cmd: salt -C 'I@telegraf:agent' state.sls telegraf
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Install elasticsearch server
cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Install kibana server
cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Install elasticsearch service
cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client.service
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Restart minions
cmd: salt -C 'I@elasticsearch:client' --async service.restart salt-minion; sleep 10;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Install elasticsearch client
cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Install kibana client
cmd: salt -C 'I@kibana:client' state.sls kibana.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Check influix db
cmd: |
INFLUXDB_SERVICE=`salt -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 -C 'I@influxdb:server' state.sls influxdb
fi
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 5}
skip_fail: true
# Collect grains needed to configure the services
- description: Get grains
cmd: salt -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 -C 'I@salt:minion' saltutil.refresh_modules
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Update mine
cmd: salt -C 'I@salt:minion' mine.update; sleep 5;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
# Configure the services running in Docker Swarm
- description: Install prometheus alertmanager
cmd: salt -C 'I@docker:swarm' state.sls prometheus.server,prometheus.alertmanager -b 1
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Pull images
cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls';
for img in pushgateway alertmanager prometheus telegraf remote_storage_adapter; do
salt -C 'I@docker:swarm' dockerng.pull "docker-sandbox.sandbox.mirantis.net/bkupidura/$img";
salt -C 'I@docker:swarm' dockerng.tag "docker-sandbox.sandbox.mirantis.net/bkupidura/$img:latest" "$img:latest";
done;
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 1}
skip_fail: false
- description: run docker state
cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: docker ps
cmd: salt -C 'I@docker:swarm' dockerng.ps
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: Configure Grafana dashboards and datasources
cmd: salt -C 'I@grafana:client' state.sls grafana.client
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false