ansible-role-server/tasks/docker-Debian.yml

62 lines
1.9 KiB
YAML
Raw Normal View History

---
# Server/Borgbackup: Install and Setup Borgbackup Backup Crobjob - Default Debian Version
# Variables:
# - none
# Detect some more host facts
- name: Docker - Detect architecture
ansible.builtin.shell: dpkg --print-architecture
register: dpkg_arch
# Install docker CE
- name: Docker - Install docker CE APT dependencies
become: true
ansible.builtin.apt:
name: "{{ packages }}"
state: present
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg2
- software-properties-common
diff: false
- name: Docker - Add docker CE repo key
become: true
ansible.builtin.get_url:
url: https://download.docker.com/linux/debian/gpg
dest: /etc/apt/trusted.gpg.d/docker.asc
mode: 0644
notify: Update Apt Cache
# IMPORTANT: raspbian needs deb [arch=armhf] https://download.docker.com/linux/raspbian ...
- name: Docker - Add docker CE repo (Debian)
when: ansible_facts['lsb']['id'] != "Raspbian"
become: true
ansible.builtin.apt_repository:
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
state: present
notify: Update Apt Cache
- name: Docker - Add docker CE repo (Raspbian)
when: ansible_facts['lsb']['id'] == "Raspbian"
become: true
ansible.builtin.apt_repository:
repo: "deb [arch={{ dpkg_arch.stdout }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable"
state: present
notify: Update Apt Cache
- name: Docker - Flush handlers
meta: flush_handlers
# Docker compose V1 (python package) doesn't receive updates since 2023-06 any more, so use the V2 instead
# The community.docker.docker_compose module won't work any more!
- name: Docker - Install docker CE
become: true
ansible.builtin.apt:
name:
- docker-ce
- docker-compose-plugin
install_recommends: false
diff: false