chore: install docker and dependencies in base role

the ansible_virtualization_type != "docker" part is used when testing in containers, since systemd is not available there
This commit is contained in:
Bert-Jan Fikse 2025-11-07 11:53:37 +01:00
parent 9e7b2b3b84
commit 3a10c57015
Signed by: bert-jan
GPG key ID: C1E0AB516AC16D1A

View file

@ -1,3 +1,61 @@
#SPDX-License-Identifier: MIT-0
---
# tasks file for base
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
when: ansible_os_family == "Debian"
- name: Install required packages for Docker
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
when: ansible_os_family == "Debian"
- name: Install convenience packages
ansible.builtin.apt:
name:
- htop
- ncdu
- vim
- curl
state: present
when: ansible_os_family == "Debian"
- name: Add Docker GPG key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/debian/gpg
state: present
when: ansible_os_family == "Debian"
- name: Add Docker repository
ansible.builtin.apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
state: present
when: ansible_os_family == "Debian"
- name: Install Docker Engine and Docker Compose plugin
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Start and enable Docker service
ansible.builtin.systemd:
name: docker
state: started
enabled: true
when: ansible_virtualization_type != "docker"