ansible. Role 9. Установка docker-swarm

Thank you for reading this post, don't forget to subscribe!

Дан­ная роль будет уста­нав­ли­вать docker на все ноды ука­зан­ные в инвен­то­ри и настра­и­вать docker-swarm.
кла­стер будет ини­ци­и­ро­вать­ся с пер­во­го ip в груп­пе swarmmaster

mkdir -p /etc/ansible/roles/docker-swarm/{handlers,tasks,templates}

cat /etc/ansible/hosts
[swarm:children]
swarmmaster
swarmworker
[swarmmaster]
192.168.1.180
192.168.1.181
192.168.1.182
[swarmworker]
192.168.1.183
192.168.1.184
192.168.1.185
[swarmNOproxy]
192.168.1.180
192.168.1.181
192.168.1.182
192.168.1.183
192.168.1.184
192.168.1.185

в груп­пе swarmmaster  мы ука­зы­ва­ем мастер сервера
в груп­пе swarmworker соот­вет­ствен­но воркеров
в груп­пе swarmNOproxy ука­зы­ва­ем все сер­ве­ра если уста­нов­ку про­из­во­дим через прок­си сервер.

cat /etc/ansible/roles/docker-swarm/handlers/main.yml

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/templates/config.json

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/templates/http-proxy.conf

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/add-repo-docker.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/add-to-hosts.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/check-packpage.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/check-swarm.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/docker-compose-preinstall.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/docker-preinstall.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/docker_proxy.yaml

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/install-docker-compose.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/install-docker.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/proxy-add-repo-docker.yml

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/proxy-docker-compose-preinstall.yml

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/proxy-docker-preinstall.yml

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/proxy-install-docker-compose.yml

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/proxy-install-docker.yml

[codesyntax lang="php" blockstate="collapsed"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/start-docker.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/swarm-add-master.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/swarm-add-worker.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/swarm-initiate-token.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/roles/docker-swarm/tasks/main.yml

[codesyntax lang="php"]

[/codesyntax]

cat /etc/ansible/playbooks/roles_play/docker-swarm.yml

[codesyntax lang="php"]

[/codesyntax]