Skip to content

Instantly share code, notes, and snippets.

@selcukusta
Created June 7, 2018 21:01
Show Gist options
  • Select an option

  • Save selcukusta/0b6e32416f74dc9181f4a0fde99d2dc6 to your computer and use it in GitHub Desktop.

Select an option

Save selcukusta/0b6e32416f74dc9181f4a0fde99d2dc6 to your computer and use it in GitHub Desktop.
---
- name: Install Docker and Docker-Compose
hosts: swarm_all
tasks:
- name: Add Docker's official GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker's apt repository
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
state: present
- name: Update and upgrade apt packages
apt:
upgrade: dist
update_cache: yes
cache_valid_time: 86400
- name: Install Docker package
apt:
name: docker-ce
state: present
- name: Enable Docker service
service:
name: docker
enabled: yes
state: started
- name: Install pip
apt:
name: python-pip
state: present
- name: Install Docker Compose
pip:
name: docker-compose
- name: Reboot server
command: /sbin/reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment