diff --git a/ansible_provisioning.sh b/ansible_provisioning.sh index e8f593b..9b3d260 100755 --- a/ansible_provisioning.sh +++ b/ansible_provisioning.sh @@ -1,4 +1,4 @@ #!/bin/bash [ `id -u` -ne 0 ] && exit 1 test -f ~/.ssh/id_rsa.pub || ssh-keygen -t rsa -b 4096 -N '' -f ~/.ssh/id_rsa -ansible-playbook -i inventory/hosts --skip-tags swarm --diff -v galera.yml +ansible-playbook -i inventory/hosts --skip-tags swarm --diff -v stack.yml diff --git a/roles/lxc_swarm/tasks/lxc_nodes.yml b/roles/lxc_swarm/tasks/lxc_nodes.yml index bb417d4..74e1f82 100644 --- a/roles/lxc_swarm/tasks/lxc_nodes.yml +++ b/roles/lxc_swarm/tasks/lxc_nodes.yml @@ -10,7 +10,7 @@ container_command: | if [ ! -d ~/.ssh ]; then mkdir ~/.ssh - echo "{{ lookup('file', my_ssh_key) }}" | tee -a ~/.ssh/authorized_keys + echo "{{ lookup('file', my_ssh_key) }}" | tee -a /root/.ssh/authorized_keys systemctl restart sshd fi with_items: diff --git a/roles/lxc_swarm/tasks/main.yml b/roles/lxc_swarm/tasks/main.yml index a3e0d88..76bf018 100644 --- a/roles/lxc_swarm/tasks/main.yml +++ b/roles/lxc_swarm/tasks/main.yml @@ -23,9 +23,6 @@ - name: container key is up-to-date locally shell: ssh-keyscan {{ workers }} >> ~/.ssh/known_hosts -# with_items: -# - "10.0.3.100" -# - "10.0.3.101" when: inventory_hostname in groups['manager'] - name: Install python on LXC container @@ -39,8 +36,8 @@ tags: swarm - setup: - tags: swarm, Dockerfile + tags: swarm - include: Dockerfile.yml when: inventory_hostname in groups['workers'] - tags: Dockerfile,swarm + tags: swarm diff --git a/roles/lxc_swarm/templates/swarm-galera.yml.j2 b/roles/lxc_swarm/templates/swarm-galera.yml.j2 deleted file mode 100644 index 426eed2..0000000 --- a/roles/lxc_swarm/templates/swarm-galera.yml.j2 +++ /dev/null @@ -1,88 +0,0 @@ -version: '3.2' - -services: - - db_cluster_node1: - - image: ubuntu:galera-node-worker1 - -# environment: -# - NODENAME={{.Node.Hostname}} -# - NODEID={{.Node.ID}} -# - SERVICEID={{.Service.ID}} -# - SERVICENAME={{.Service.Name}} -# - TASKID={{.Task.ID}} -# - TASKNAME={{.Task.Name}} -# - TASKREPID={{.Task.Slot}} - - volumes: - - - /var/container_data/mysql:/var/lib/mysql - - networks: - galera_net: - - deploy: - replicas: 1 - restart_policy: - delay: 10s - max_attempts: 10 - window: 60s - placement: - constraints: - - node.labels.node1 == true - - node.role == worker - #- node.group == galera - ports: - - mode: host - # target: 3306 - # published: 3306 - target: 4567 - published: 4567 - # target: 4568 - # published: 4568 - # target: 4568 - # published: 4568 - - #- "10.0.3.100:3306:3306" - #- "10.0.3.100:4567:4567" - #- "10.0.3.100:4568:4568" - #- "10.0.3.100:4444:4444" - - db_cluster_node2: - - image: ubuntu:galera-node-worker2 - - volumes: - - - /var/container_data/mysql:/var/lib/mysql - - networks: - galera_net: - - deploy: - replicas: 1 - restart_policy: - delay: 10s - max_attempts: 10 - window: 60s - placement: - constraints: - - node.labels.node2 == true - - node.role == worker -# - node.group == galera - depends_on: - - db_cluster_node1 - ports: - - mode: host - target: 4567 - published: 4567 -# - "10.0.3.101:3306:3306" -# - "10.0.3.101:4567:4567" -# - "10.0.3.101:4568:4568" -# - "10.0.3.101:4444:4444" - - -networks: - galera_net: - diff --git a/galera.yml b/stack.yml similarity index 100% rename from galera.yml rename to stack.yml