nixos-servers/legacy/ansible_roles/docker/tasks/main.yml

36 lines
898 B
YAML

- name: Install prerequisites
apt:
pkg:
- ca-certificates
- curl
- lsb-release
- gnupg
- python3-pip
- name: Add APT key
apt_key:
url: https://download.docker.com/linux/debian/gpg
keyring: /etc/apt/trusted.gpg.d/docker.gpg
- name: Add repository
apt_repository:
repo: "deb [signed-by=/etc/apt/trusted.gpg.d/docker.gpg] https://download.docker.com/linux/{{ docker_repository }} {{ ansible_distribution_release }} stable"
- name: Install Docker
apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
# - docker-compose-plugin
- name: Install Python modules
pip:
name:
- docker
# - docker-compose
- name: Copy daemon.json
copy:
dest: /etc/docker/daemon.json
content: "{{ docker_daemon_config | to_json }}"
- name: Start Docker
systemd:
name: docker
enabled: true
state: started