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

@ -28,7 +28,7 @@
create: yes
block: |
[User]
SystemAccount=true
SystemAccount=true
backup: no
- name: Create docker dir
@ -55,16 +55,41 @@
group: root
state: link
- name: Packages for docker
- name: Remove packages for docker from default repo
apt:
name:
name:
- docker.io
- docker-compose
- apache2-utils
- bridge-utils
- containerd
- runc
state: absent
update_cache: 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
blockinfile:
path: /usr/local/sbin/autoupdate.d/docker.update
@ -99,7 +124,7 @@
g_echo_error "$docker: docker-compose build fehlgeschlagen: $(cat $g_tmp/build)"
fi
fi
done
done
backup: yes
validate: /bin/bash -n %s
@ -133,7 +158,25 @@
if [ $OLD_BACKUPS -gt $DAYS ]; then
find $BACKUPDIR -name "$i*.gz" -daystart -mtime +$DAYS -delete
fi
done
done
backup: yes
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"