Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,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"
Expand Down
5 changes: 5 additions & 0 deletions tasks/deps-debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Install prerequisite packages
ansible.builtin.apt:
name: "{{ dependency_packages }}"
state: present
4 changes: 4 additions & 0 deletions tasks/deps-redhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Install prerequisite packages
ansible.builtin.package:
name: "{{ dependency_packages }}"
state: present
10 changes: 10 additions & 0 deletions tasks/docker-compose-plugin.yml
Original file line number Diff line number Diff line change
@@ -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"
File renamed without changes.
7 changes: 5 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
tags:
- always

- ansible.builtin.include_tasks: deps-{{ ansible_os_family | lower }}.yml
when: ansible_os_family in ['RedHat', 'Debian', 'Archlinux'] # supported os family

- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
Expand Down Expand Up @@ -173,9 +176,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
Expand Down
2 changes: 2 additions & 0 deletions vars/debian-11.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
docker_ip_nft_tables_packages:
iptables: "iptables"
dependency_packages:
- python3-apt
2 changes: 2 additions & 0 deletions vars/debian-12.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
docker_ip_nft_tables_packages:
iptables: "iptables"
dependency_packages:
- python3-apt
2 changes: 2 additions & 0 deletions vars/debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
docker_ip_nft_tables_packages:
iptables: "iptables"
dependency_packages:
- python3-apt
2 changes: 2 additions & 0 deletions vars/ubuntu-22.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
docker_ip_nft_tables_packages:
iptables: "iptables"
dependency_packages:
- python3-apt
2 changes: 2 additions & 0 deletions vars/ubuntu-24.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
docker_ip_nft_tables_packages:
iptables: "iptables"
dependency_packages:
- python3-apt
2 changes: 2 additions & 0 deletions vars/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
docker_ip_nft_tables_packages:
iptables: "iptables"
dependency_packages:
- python3-apt