From 66ec85b918024726e56599d2b29e0702f86b0223 Mon Sep 17 00:00:00 2001 From: Prakasa Date: Tue, 26 Aug 2025 06:17:01 +0700 Subject: [PATCH 1/4] fix: add new tasks, install missing deps --- tasks/deps-debian.yml | 5 +++++ tasks/deps-redhat.yml | 4 ++++ vars/debian-11.yml | 2 ++ vars/debian-12.yml | 2 ++ vars/debian.yml | 2 ++ vars/ubuntu-22.yml | 2 ++ vars/ubuntu-24.yml | 2 ++ vars/ubuntu.yml | 2 ++ 8 files changed, 21 insertions(+) create mode 100644 tasks/deps-debian.yml create mode 100644 tasks/deps-redhat.yml diff --git a/tasks/deps-debian.yml b/tasks/deps-debian.yml new file mode 100644 index 0000000..1d31815 --- /dev/null +++ b/tasks/deps-debian.yml @@ -0,0 +1,5 @@ +--- +- name: Install prerequisite packages + ansible.builtin.apt: + name: "{{ dependency_packages }}" + state: present \ No newline at end of file diff --git a/tasks/deps-redhat.yml b/tasks/deps-redhat.yml new file mode 100644 index 0000000..e897bfe --- /dev/null +++ b/tasks/deps-redhat.yml @@ -0,0 +1,4 @@ +- name: Install prerequisite packages + ansible.builtin.package: + name: "{{ dependency_packages }}" + state: present \ No newline at end of file diff --git a/vars/debian-11.yml b/vars/debian-11.yml index c0aa297..e0aa8b0 100644 --- a/vars/debian-11.yml +++ b/vars/debian-11.yml @@ -1,3 +1,5 @@ --- docker_ip_nft_tables_packages: iptables: "iptables" +dependency_packages: + - python3-apt \ No newline at end of file diff --git a/vars/debian-12.yml b/vars/debian-12.yml index c0aa297..e0aa8b0 100644 --- a/vars/debian-12.yml +++ b/vars/debian-12.yml @@ -1,3 +1,5 @@ --- docker_ip_nft_tables_packages: iptables: "iptables" +dependency_packages: + - python3-apt \ No newline at end of file diff --git a/vars/debian.yml b/vars/debian.yml index c0aa297..e0aa8b0 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -1,3 +1,5 @@ --- docker_ip_nft_tables_packages: iptables: "iptables" +dependency_packages: + - python3-apt \ No newline at end of file diff --git a/vars/ubuntu-22.yml b/vars/ubuntu-22.yml index c0aa297..e0aa8b0 100644 --- a/vars/ubuntu-22.yml +++ b/vars/ubuntu-22.yml @@ -1,3 +1,5 @@ --- docker_ip_nft_tables_packages: iptables: "iptables" +dependency_packages: + - python3-apt \ No newline at end of file diff --git a/vars/ubuntu-24.yml b/vars/ubuntu-24.yml index c0aa297..e0aa8b0 100644 --- a/vars/ubuntu-24.yml +++ b/vars/ubuntu-24.yml @@ -1,3 +1,5 @@ --- docker_ip_nft_tables_packages: iptables: "iptables" +dependency_packages: + - python3-apt \ No newline at end of file diff --git a/vars/ubuntu.yml b/vars/ubuntu.yml index c0aa297..e0aa8b0 100644 --- a/vars/ubuntu.yml +++ b/vars/ubuntu.yml @@ -1,3 +1,5 @@ --- docker_ip_nft_tables_packages: iptables: "iptables" +dependency_packages: + - python3-apt \ No newline at end of file From 182f00a79ddf02e0b732726dfb7b343ffbaf3f22 Mon Sep 17 00:00:00 2001 From: Prakasa Date: Fri, 3 Apr 2026 12:11:57 +0700 Subject: [PATCH 2/4] feat: support to install docker compose as docker CLI plugins --- defaults/main.yml | 13 ++++++------- tasks/docker-compose-plugin.yml | 10 ++++++++++ ...er-compose.yml => docker-compose-standalone.yml} | 0 tasks/main.yml | 4 ++-- 4 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 tasks/docker-compose-plugin.yml rename tasks/{docker-compose.yml => docker-compose-standalone.yml} (100%) diff --git a/defaults/main.yml b/defaults/main.yml index c0252ba..077742d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -69,15 +69,14 @@ docker_ca_certificates_src_dir: "{{ '~/docker-ca-certificates' | expanduser }}" # certificate files (besides other locations). docker_ca_certificates_dst_dir: "/usr/local/share/ca-certificates" -# Currently only "standalone" is supported. So that means on the remote host -# "docker-compose" command will be available and not the "docker compose" -# plugin (without "-"). -# When commented no "docker-compose" will be installed and all "docker_compose_*" -# variables are ignored. -# docker_compose_type: "standalone" +# 2 kind of compose installation are supported (standalone to support legacy environments): +# - standalone: The standalone "docker-compose" binary. This is the old way to use "docker-compose". The binary is called "docker-compose" and is installed in a directory defined by `docker_compose_bin_directory` variable. This is the default value for `docker_compose_type` variable. +# - plugin: The "docker compose" plugin for "docker" CLI. This is the new way to use "docker-compose". The binary is called "docker-compose" and is installed in "/usr/local/lib/docker/cli-plugins/docker-compose". This is the recommended way to use "docker-compose" and is the default value for `docker_compose_type` variable. +# When commented no "docker-compose" will be installed and all "docker_compose_*" variables will be ignored. +docker_compose_type: "plugin" # "docker-compose" version -docker_compose_version: "2.38.2" +docker_compose_version: "5.1.1" # The directory where to "docker-compose" binary will be installed docker_compose_bin_directory: "/usr/local/bin" diff --git a/tasks/docker-compose-plugin.yml b/tasks/docker-compose-plugin.yml new file mode 100644 index 0000000..1086d60 --- /dev/null +++ b/tasks/docker-compose-plugin.yml @@ -0,0 +1,10 @@ +--- + +- name: Downloading docker compose plugins binary v2 and make exec + ansible.builtin.get_url: + url: "https://github.com/docker/compose/releases/download/v{{ docker_compose_version }}/docker-compose-{{ ansible_system | lower }}-{{ ansible_architecture }}" + dest: "/usr/local/lib/docker/cli-plugins/docker-compose" + mode: "{{ docker_compose_bin_file_perm }}" + owner: "{{ docker_compose_bin_owner }}" + group: "{{ docker_compose_bin_group }}" + checksum: "sha256:https://github.com/docker/compose/releases/download/v{{ docker_compose_version }}/docker-compose-{{ ansible_system | lower }}-{{ ansible_architecture }}.sha256" \ No newline at end of file diff --git a/tasks/docker-compose.yml b/tasks/docker-compose-standalone.yml similarity index 100% rename from tasks/docker-compose.yml rename to tasks/docker-compose-standalone.yml diff --git a/tasks/main.yml b/tasks/main.yml index 83bbe54..cd6355a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -241,9 +241,9 @@ - name: Install docker-compose binary when: - - docker_compose_type is defined + - docker_compose_type is defined and docker_compose_type in ['standalone', 'plugin'] ansible.builtin.include_tasks: - file: "tasks/docker-compose.yml" + file: "tasks/docker-compose-{{ docker_compose_type }}.yml" apply: tags: - docker-compose From 6bb25736c3dc8a76017848d5393cf18d35cead15 Mon Sep 17 00:00:00 2001 From: Prakasa Date: Fri, 12 Jun 2026 22:44:29 +0400 Subject: [PATCH 3/4] fix: rebase to origin --- tasks/docker-compose-plugin.yml | 8 ++++++++ tasks/main.yml | 15 ++------------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tasks/docker-compose-plugin.yml b/tasks/docker-compose-plugin.yml index 1086d60..bdf7eda 100644 --- a/tasks/docker-compose-plugin.yml +++ b/tasks/docker-compose-plugin.yml @@ -1,5 +1,13 @@ --- +- name: Ensure docker compose cli plugins directory exists + ansible.builtin.file: + path: /usr/local/lib/docker/cli-plugins + state: directory + owner: root + group: root + mode: "0755" + - name: Downloading docker compose plugins binary v2 and make exec ansible.builtin.get_url: url: "https://github.com/docker/compose/releases/download/v{{ docker_compose_version }}/docker-compose-{{ ansible_system | lower }}-{{ ansible_architecture }}" diff --git a/tasks/main.yml b/tasks/main.yml index cd6355a..1a6d9cc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -16,19 +16,8 @@ tags: - always -- name: Bootstrap python3-apt on Debian family hosts - when: - - ansible_facts['os_family'] == "Debian" - ansible.builtin.raw: | - if python3 -c 'import apt' >/dev/null 2>&1; then - echo "python3-apt already present" - else - export DEBIAN_FRONTEND=noninteractive - apt-get update - apt-get install -y python3-apt - fi - register: docker__python3_apt_bootstrap - changed_when: "'python3-apt already present' not in docker__python3_apt_bootstrap.stdout" +- ansible.builtin.include_tasks: deps-{{ ansible_os_family | lower }}.yml + when: ansible_os_family in ['RedHat', 'Debian'] # supported os family - name: Gather the package facts ansible.builtin.package_facts: From 093b2cff629d1ae30ff1713f53a131e593756b31 Mon Sep 17 00:00:00 2001 From: Prakasa Date: Fri, 12 Jun 2026 22:50:51 +0400 Subject: [PATCH 4/4] revert: default type to standalone installer Co-authored-by: Robert Wimmer <2039811+githubixx@users.noreply.github.com> --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 077742d..674af76 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -73,7 +73,7 @@ docker_ca_certificates_dst_dir: "/usr/local/share/ca-certificates" # - standalone: The standalone "docker-compose" binary. This is the old way to use "docker-compose". The binary is called "docker-compose" and is installed in a directory defined by `docker_compose_bin_directory` variable. This is the default value for `docker_compose_type` variable. # - plugin: The "docker compose" plugin for "docker" CLI. This is the new way to use "docker-compose". The binary is called "docker-compose" and is installed in "/usr/local/lib/docker/cli-plugins/docker-compose". This is the recommended way to use "docker-compose" and is the default value for `docker_compose_type` variable. # When commented no "docker-compose" will be installed and all "docker_compose_*" variables will be ignored. -docker_compose_type: "plugin" +docker_compose_type: "standalone" # "docker-compose" version docker_compose_version: "5.1.1"