This Ansible playbook install docker and docker-compose with the latest version of docker.
- docker
- Just installs docker and skips other tags.
- docker-compose
- Just installs docker-compose and skips other tags.
Example with DNS hostnames and the same SSH username as your system
all:
hosts:
hostname-01:
hostname-02:
Example with another username and no dns server that could resolve the hostnames.
all:
hosts:
hostname-01:
ansible_user: ubuntu
ansible_host: 192.168.1.10
hostname-02:
ansible_user: ubuntu
ansible_host: 192.168.1.11
---
- name: Set facts for environment
set_fact:
custom_user:
available: true
username: ubuntu
docker:
# Docker versions: stable, nightly, test
version: stable
docker_compose:
version: "1.26.0"
Default example to run the playbook
ansible-playbook -i hosts.yml site.yml -vvvv
Custom example with specific tags
ansible-playbook -i hosts.yml site.yml --tags=docker,docker-compose -vvvv
Custom example with hostname limit
ansible-playbook -i hosts.yml site.yml --limit=hostname-01 -vvvv
Build and Managed by: Djamon Staal