Files
ansible-pi/roles/docker/tasks/main.yml

43 lines
985 B
YAML

---
- name: Install initial dependencies
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
update_cache: yes
- name: Add Docker official GPG key
apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
- name: Set up Docker repository for ARM architecture
apt_repository:
repo: "deb [arch={{ 'arm64' if ansible_architecture == 'aarch64' else 'armhf' }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
state: present
- name: Install Docker Engine and CLI components
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
update_cache: yes
- name: Ensure Docker service is started and enabled
systemd:
name: docker
state: started
enabled: yes
- name: Add current user to docker group
user:
name: "{{ ansible_user }}"
groups: docker
append: yes