root
5 years ago
4 changed files with 60 additions and 17 deletions
@ -1,3 +1,39 @@ |
|||||
--- |
--- |
||||
|
- name: Create swarm secrets |
||||
|
shell: | |
||||
|
mkdir -p .secrets |
||||
|
openssl rand -base64 32 > .secrets/xtrabackup_password |
||||
|
openssl rand -base64 32 > .secrets/mysql_password |
||||
|
openssl rand -base64 32 > .secrets/mysql_root_password |
||||
|
run_once: true |
||||
|
|
||||
- name: Deploy swarm stack |
- name: Deploy swarm stack |
||||
shell: docker stack deploy -c stack.yaml stack |
shell: docker stack deploy -c stack_mariadb.yaml stack |
||||
|
|
||||
|
- name: Update swarm stack with proper environmental variables |
||||
|
shell: | |
||||
|
unset MASTER_ADDR |
||||
|
mcontainer_addr=`ssh root@10.0.3.100 "docker ps|xargs -n1|grep -i NAMES -A 1|tail -1"` |
||||
|
MASTER_ADDR=`ssh -t root@10.0.3.100 "docker exec -it $mcontainer_addr ip a s|grep -i 10.0|head -1 2>/dev/null" 2>&1 |grep inet|awk '{print $2}'|cut -d "/" -f 1|tr -d ' '` |
||||
|
env MASTER_ADDR="${MASTER_ADDR}" docker stack deploy -c stack_mariadb.yaml stack |
||||
|
docker service scale stack_bnode=1 |
||||
|
sleep 30 |
||||
|
args: |
||||
|
executable: /bin/bash |
||||
|
|
||||
|
#- name: Wait for seed container to start |
||||
|
# pause: |
||||
|
# seconds: 30 |
||||
|
|
||||
|
#- name: Start mariadb cluster on node1 |
||||
|
# shell: docker service scale stack_node1=1 |
||||
|
|
||||
|
#- name: Remove seed container |
||||
|
# shell: docker service rm stack_seed |
||||
|
|
||||
|
#- name: Wait for nodes[0] container to start |
||||
|
# pause: |
||||
|
# seconds: 30 |
||||
|
|
||||
|
#- name: Start mariadb on node2 |
||||
|
# shell: docker service scale stack_bnode=1 |
||||
|
Loading…
Reference in new issue