Skip to content

Instantly share code, notes, and snippets.

@tumf
Last active January 16, 2021 09:59
Show Gist options
  • Save tumf/790392475a6927cbdde923f23f1c6431 to your computer and use it in GitHub Desktop.
Save tumf/790392475a6927cbdde923f23f1c6431 to your computer and use it in GitHub Desktop.
---
- hosts: all
become: yes
tasks:
- name: Update apt packages
apt:
upgrade: no
update_cache: yes
- name: Install packages for docker
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: Add Docker’s official GPG key
command: |
sh -c "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -"
- name: Set up the stable Docker repository
command: |
sh -c "add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\""
- name: Update apt packages
apt:
upgrade: no
update_cache: yes
- name: Install Docker packages
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- stat: path=/usr/local/bin/docker-compose
register: docker_compose
- name: Download Docker compose
when: not docker_compose.stat.exists
command: |
sh -c "curl -L \"https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose"
- file:
path: /usr/local/bin/docker-compose
mode: '0755'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment