Files
2026-09-18 20:07:04 +02:00

61 lines
1.6 KiB
YAML

---
# Install Docker CE (rootful) from the official Docker apt repository.
# ponytail: rootful Docker only for this PoC; rootless is explicitly deferred (see plan.md).
- name: Gather OS release facts
ansible.builtin.setup:
gather_subset:
- distribution
- name: Install prerequisite packages
ansible.builtin.apt:
name:
- ca-certificates
- curl
- gnupg
state: present
update_cache: true
- name: Create keyrings directory
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
mode: "0755"
- name: Download Docker GPG key
ansible.builtin.get_url:
url: "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}/gpg"
dest: /etc/apt/keyrings/docker.asc
mode: "0644"
force: false
- name: Add Docker apt repository
ansible.builtin.deb822_repository:
name: docker
types: deb
uris: "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}"
suites: "{{ ansible_facts['distribution_release'] }}"
components: stable
architectures: "{{ 'amd64' if ansible_facts['architecture'] == 'x86_64' else ansible_facts['architecture'] }}"
signed_by: /etc/apt/keyrings/docker.asc
state: present
- name: Update apt cache after adding Docker repository
ansible.builtin.apt:
update_cache: true
- name: Install Docker packages
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: present
- name: Ensure Docker service is enabled and running
ansible.builtin.systemd_service:
name: docker
enabled: true
state: started