Files
docker/setup-docker.yaml
Matan Horovitz 0838da4d20
Some checks failed
Configure Domain / deploy (push) Failing after 1m17s
Rename files; use vars file
2023-11-24 19:28:25 +02:00

61 lines
1.6 KiB
YAML

- name: Set Docker repo architecture
ansible.builtin.set_fact:
docker_arch: "{{ 'amd64' if ansible_architecture == 'x86_64' else 'ansible_architecture' }}"
- name: Install prerequisites for Docker repository
ansible.builtin.apt:
name:
- ca-certificates
- curl
- gnupg2
- lsb-release
state: latest
- name: Add Docker's APT key
ansible.builtin.apt_key:
#url: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg"
# ^ ex: Ubuntu -> ubuntu
url: "https://download.docker.com/linux/ubuntu/gpg"
state: present
ignore_errors: yes
- name: Add Docker's APT repo
ansible.builtin.apt_repository:
# repo: "deb [arch={{ docker_arch }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
repo: "deb [arch={{ docker_arch }}] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
update_cache: yes
ignore_errors: yes
- name: Install docker and dependencies
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: latest
- name: Start and enable Docker daemon
become: yes
ansible.builtin.service:
name: docker
state: started
enabled: yes
- name: Start and enable Containerd daemon
become: yes
ansible.builtin.service:
name: containerd
state: started
enabled: yes
- name: Install Docker Python modules
ansible.builtin.pip:
name:
- docker
- docker-compose
state: latest