From 3d281fffc26bfe15713905f289ab44c52a0ec45b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 14 Jul 2024 23:12:44 +0100 Subject: [PATCH] Use modern versions of docker-compose on Debian Install the plugin and use switch, rather than downloading an arbitrary binary. This way, it keeps getting updated. --- ansible/galaxy-requirements.yml | 2 +- ansible/group_vars/all/docker.yml | 10 ++++++++++ ansible/main.yml | 5 ----- ansible/roles/docker_cleanup/tasks/main.yml | 8 ++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ansible/galaxy-requirements.yml b/ansible/galaxy-requirements.yml index b5848b3..161b281 100644 --- a/ansible/galaxy-requirements.yml +++ b/ansible/galaxy-requirements.yml @@ -8,7 +8,7 @@ collections: roles: - src: geerlingguy.docker - version: 6.2.0 + version: 7.3.0 - src: geerlingguy.ntp version: 2.5.0 - src: realorangeone.reflector diff --git a/ansible/group_vars/all/docker.yml b/ansible/group_vars/all/docker.yml index 9bd3658..6e04168 100644 --- a/ansible/group_vars/all/docker.yml +++ b/ansible/group_vars/all/docker.yml @@ -2,7 +2,17 @@ docker_user: id: 3000 name: dockeruser +docker_users: + - "{{ me.user }}" + docker_compose_file_mask: "664" docker_compose_directory_mask: "775" +# HACK: Use compose-switch as the install for compose, so the commands still work. +# Run this task manually, as version comparisons usually fail +docker_compose_url: https://github.com/docker/compose-switch/releases/latest/download/docker-compose-linux-{{ docker_apt_arch }} +docker_install_compose: false + +docker_install_compose_plugin: "{{ ansible_os_family == 'Debian' }}" + docker_update_command: docker-compose pull && docker-compose down --remove-orphans && docker-compose rm && docker-compose up -d diff --git a/ansible/main.yml b/ansible/main.yml index 306393d..563d5fe 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -40,11 +40,6 @@ roles: - role: geerlingguy.docker become: true - vars: - docker_install_compose_plugin: "{{ ansible_os_family == 'Debian' }}" - docker_install_compose: "{{ ansible_os_family == 'Debian' }}" - docker_users: - - "{{ me.user }}" - docker_cleanup - hosts: diff --git a/ansible/roles/docker_cleanup/tasks/main.yml b/ansible/roles/docker_cleanup/tasks/main.yml index 98e3354..0f5b98b 100644 --- a/ansible/roles/docker_cleanup/tasks/main.yml +++ b/ansible/roles/docker_cleanup/tasks/main.yml @@ -4,6 +4,14 @@ become: true when: ansible_os_family != 'Debian' +- name: Install compose-switch + get_url: + url: "{{ docker_compose_url }}" + dest: "{{ docker_compose_path }}" + mode: "0755" + become: true + when: ansible_os_family == 'Debian' + - name: Create docker group group: name: "{{ docker_user.name }}"