Skip to content

Instantly share code, notes, and snippets.

@jimfilippou
Created January 12, 2024 13:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimfilippou/09d0e4a0ef6dfaeb524754f59fb18b4c to your computer and use it in GitHub Desktop.
Save jimfilippou/09d0e4a0ef6dfaeb524754f59fb18b4c to your computer and use it in GitHub Desktop.
- name: Install Docker (including compose)
hosts: all
become: true
tasks:
- name: Update apt cache
apt:
update_cache: yes
- name: Install dependencies via apt
apt:
name:
- ca-certificates
- curl
- gnupg
- 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 apt cache
apt:
update_cache: yes
- name: Install Docker
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
- name: Add user to Docker group
user:
name: root # Please use another user, not root :-)
append: yes
groups: docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment