Skip to content

Commit

Permalink
Add README. Comment on ansible prereqs on targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
drmalex07 committed Sep 12, 2017
1 parent 22c2b44 commit eac1667
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# README - Setup docker swarm #

## 0. Prerequisites ##

You must install `Ansible` on the control machine, preferably in a virtual Python environment:

virtualenv pyenv
. pyenv/bin/activate
pip install ansible==2.2 netaddr

## 1. Prepare your inventory ##

An single inventory file should be created at `hosts.yml`. Both `vagrant` and `ansible` will use this. An example inventory file can be found [here](hosts.yml.example).

## 2.1 Setup with Vagrant and Ansible ##

If we want a full Vagrant environment (of course we will also need `vagrant` installed), then:

vagrant up

In this case, `vagrant` will provide the virtual machines (via virtualbox) and setup the private network,
and then will delegate to an `ansible` playbook to actually setup the swarm nodes.

## 2.2 Setup with Ansible only ##

If the target machines (either virtual or physical) are already setup and networked (usually in a private network),
then we can directly play the Ansible playbook:

ansible-playbook play.yml


4 changes: 4 additions & 0 deletions install-ansible-prereqs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

#
# Install Ansible prerequisites on the remote host
#

if [ ! -f ~/.ansible-prereqs-installed ]; then
apt-get install -y python
[ "$?" -eq 0 ] && touch ~/.ansible-prereqs-installed
Expand Down

0 comments on commit eac1667

Please sign in to comment.