newer docker and docker compose

needed fpr mailcow.
remove docker from default debian repo if installed, add repo "download.docker.com" and install from there.
docker-compose command/alias for backward compatibility - now docker compose
This commit is contained in:
olli 2023-04-12 09:29:57 +02:00
parent 6833113e99
commit 8f3aaf6b67

View File

@ -55,16 +55,41 @@
group: root group: root
state: link state: link
- name: Packages for docker - name: Remove packages for docker from default repo
apt: apt:
name: name:
- docker.io - docker.io
- docker-compose - docker-compose
- apache2-utils - containerd
- bridge-utils - runc
state: absent
update_cache: no update_cache: no
install_recommends: no install_recommends: no
- name: Add signing key
ansible.builtin.apt_key:
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
state: present
- name: Add repository into sources list
ansible.builtin.apt_repository:
repo: "deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present
filename: docker
- name: Packages for docker
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
- bridge-utils
- apache2-utils
update_cache: yes
install_recommends: no
- name: /usr/local/sbin/autoupdate.d/docker.update - name: /usr/local/sbin/autoupdate.d/docker.update
blockinfile: blockinfile:
path: /usr/local/sbin/autoupdate.d/docker.update path: /usr/local/sbin/autoupdate.d/docker.update
@ -137,3 +162,21 @@
backup: yes backup: yes
validate: /bin/bash -n %s validate: /bin/bash -n %s
- name: docker-compose command/alias for backward compatibility - now docker compose
blockinfile:
path: /usr/local/sbin/docker-compose
mode: "0755"
owner: root
group: root
create: yes
marker: "# {mark} ANSIBLE MANAGED BLOCK"
block: |
docker compose $@
backup: yes
validate: /bin/bash -n %s
- name: /usr/local/sbin/docker-compose shebang
lineinfile:
path: /usr/local/sbin/docker-compose
insertbefore: BOF
line: "#!/bin/bash -e"