refactor: use modern deb822 repository module

This commit is contained in:
2026-08-04 22:12:05 +02:00
parent f59952df2b
commit bdd1c07d76
2 changed files with 11 additions and 27 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
--- ---
requires_ansible: ">=2.14.0" requires_ansible: ">=2.15.0"
+10 -26
View File
@@ -4,36 +4,20 @@
name: name:
- ca-certificates - ca-certificates
- curl - curl
- python3-debian ## needed for the deb822 module
state: present state: present
update_cache: true update_cache: true
become: true become: true
- name: Ensure APT keyrings directory exists - name: Add Docker official APT repository (DEB822 format)
ansible.builtin.file: ansible.builtin.deb822_repository:
path: /etc/apt/keyrings name: docker
state: directory types: deb
mode: "0755" uris: "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}"
become: true suites: "{{ ansible_facts['distribution_release'] }}"
components: stable
- name: Download Docker official GPG key signed_by: "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}/gpg"
ansible.builtin.get_url:
url: "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}/gpg"
dest: /etc/apt/keyrings/docker.asc
mode: "0644"
become: true
- name: Get system architecture
ansible.builtin.command: dpkg --print-architecture
register: dpkg_architecture
changed_when: false
become: true
- name: Add Docker official APT repository
ansible.builtin.apt_repository:
repo: "deb [arch={{ dpkg_architecture.stdout }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }} {{ ansible_facts['distribution_release'] }} stable"
state: present state: present
filename: docker
update_cache: yes
become: true become: true
- name: Install modern Docker CE packages - name: Install modern Docker CE packages
@@ -77,7 +61,7 @@
gid: 9999 gid: 9999
become: true become: true
- name: Create appuser user for secure container execution - name: Create app user for secure container execution
ansible.builtin.user: ansible.builtin.user:
name: appuser name: appuser
state: present state: present