Galera cluster deployment based on docker swarm using Linux Containers (LXC) with automatic deployment via Ansible.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

5 years ago
---
- 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
5 years ago
- name: Deploy swarm stack deployment file
shell: docker stack deploy -c stack.yaml stack
#- pause:
# seconds: 30
5 years ago
- name: Update swarm stack service "bnode" with proper environmental variables
shell: |
sleep 60; 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 ' '`
[ -z $MASTER_ADDR ] && echo "Node 1 hasn't yet been initialized"
5 years ago
env MASTER_ADDR="${MASTER_ADDR}" docker stack deploy -c stack.yaml stack
# env MASTER_ADDR="${MASTER_ADDR}" docker service scale stack_bnode=1
5 years ago
# sleep 30
args:
executable: /bin/bash
#- name: Wait for nodes[0] container to start
# pause:
# seconds: 30
#- name: Start mariadb on node2
# shell: docker service scale stack_bnode=1