Skip to content

rohitggarg/docker-swarm

Repository files navigation

Running the swarm using vagrant photon os

vagrant up

create vault key

touch vault-key

Swarm

Insecure Setup

execute ansible command

ansible-playbook [email protected] swarm_config.yml

for checking the swarm

docker -H 192.168.99.20 service ls
docker -H 192.168.99.21 service ls

Secure TLS setup

enable docker_connect_secure in vagrant.yml

    docker_connect_secure: yes

decide where would you want to keep CA cert+key by editing vagrant.yml for localhost or bootstrap

docker_ca_host: localhost
docker_ca_group: localhost

if localhost, you need to put ansible_sudo_pass in swarm_config.yml

- hosts: "{{ docker_ca_group }}"
  vars:
    vagrant_mc_name: "{{ docker_ca_host }}"
    ansible_sudo_pass: password

execute ansible command

mkdir docker-certs
ansible-playbook [email protected] swarm_config.yml

one can to login to the bootstrap machine to see the swarm state

vagrant ssh bootstrap
docker service ls
vagrant ssh master
docker service ls

from local machine, you can use this command

docker --tlsverify --tlscacert docker-certs/ca.pem --tlscert docker-certs/localhost/docker-certs/localhost-client-cert.pem --tlskey docker-certs/key.pem -H 192.168.99.20:2376 service ls
docker --tlsverify --tlscacert docker-certs/ca.pem --tlscert docker-certs/localhost/docker-certs/localhost-client-cert.pem --tlskey docker-certs/key.pem -H 192.168.99.21:2376 service ls

About

Ansible playbooks for creating docker swarm using docker 1.12+

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •