46 lines
1 KiB
YAML
46 lines
1 KiB
YAML
- name: Install Docker prerequisites
|
|
apt:
|
|
pkg:
|
|
- ca-certificates
|
|
- curl
|
|
- gnupg
|
|
- lsb-release
|
|
- python3-pip
|
|
- name: Add Docker APT key
|
|
apt_key:
|
|
url: https://download.docker.com/linux/debian/gpg
|
|
state: present
|
|
- name: Add Docker repository
|
|
apt_repository:
|
|
repo: "deb https://download.docker.com/linux/debian bullseye stable"
|
|
state: present
|
|
register: apt_repository
|
|
- name: Update APT cache
|
|
apt:
|
|
update_cache: true
|
|
when: apt_repository.changed
|
|
- name: Install Docker packages
|
|
apt:
|
|
pkg:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|
|
- docker-compose-plugin
|
|
- name: Install Docker modules for Python
|
|
pip:
|
|
name:
|
|
- docker
|
|
- docker-compose
|
|
- name: Create /etc/docker directory
|
|
file:
|
|
path: "/etc/docker"
|
|
state: directory
|
|
- name: Copy daemon.json
|
|
copy:
|
|
src: "{{ role_path }}/files/daemon.json"
|
|
dest: /etc/docker/daemon.json
|
|
- name: Start Docker
|
|
systemd:
|
|
name: docker
|
|
enabled: true
|
|
state: started
|