From 43b5ad4fef027c2e32f3160ad9cb3a7515d88642 Mon Sep 17 00:00:00 2001 From: Dale Anderson Date: Fri, 30 Dec 2022 14:56:00 -0800 Subject: [PATCH 01/10] Override defaults for Pop!_OS --- vars/Pop!_OS.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 vars/Pop!_OS.yml diff --git a/vars/Pop!_OS.yml b/vars/Pop!_OS.yml new file mode 100644 index 0000000..805a36b --- /dev/null +++ b/vars/Pop!_OS.yml @@ -0,0 +1,13 @@ +--- +# Since: +# * `ansible_distribution` evaluates to Pop!_OS, and +# * docker does not (yet) support Pop!_OS, and +# * Pop_OS is effectively Ubuntu (for our purposes), and +# * There isn't a 'better' variable we easily use +# we need to just wire in 'ubuntu' instead of relying on `ansible_distribution`. + +# If "https://download.docker.com/linux/pop!_os/gpg" ever exists, this can be removed. +docker_apt_gpg_key: "{{ docker_repo_url }}/ubuntu/gpg" + +# If "https://download.docker.com/linux/pop!_os/....." ever exists, this can be removed. +docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/ubuntu {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" From 48688d0fafa3003b90f72ab6a9ac78bd5c8b6e2c Mon Sep 17 00:00:00 2001 From: Dale Anderson Date: Fri, 30 Dec 2022 15:17:35 -0800 Subject: [PATCH 02/10] Handle the exception more cleanly --- defaults/main.yml | 5 +++-- vars/Pop!_OS.yml | 13 ------------- 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 vars/Pop!_OS.yml diff --git a/defaults/main.yml b/defaults/main.yml index 685b8de..6f3fd6f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -31,10 +31,11 @@ docker_repo_url: https://download.docker.com/linux # Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed. docker_apt_release_channel: stable +docker_apt_ansible_distro_name: "{{ 'ubuntu' if ansible_distribution == 'Pop!_OS' else ansible_distribution }}" docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" -docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ docker_apt_ansible_distro_name | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true -docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" +docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distro_name | lower }}/gpg" # Used only for RedHat/CentOS/Fedora. docker_yum_repo_url: "{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo" diff --git a/vars/Pop!_OS.yml b/vars/Pop!_OS.yml deleted file mode 100644 index 805a36b..0000000 --- a/vars/Pop!_OS.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# Since: -# * `ansible_distribution` evaluates to Pop!_OS, and -# * docker does not (yet) support Pop!_OS, and -# * Pop_OS is effectively Ubuntu (for our purposes), and -# * There isn't a 'better' variable we easily use -# we need to just wire in 'ubuntu' instead of relying on `ansible_distribution`. - -# If "https://download.docker.com/linux/pop!_os/gpg" ever exists, this can be removed. -docker_apt_gpg_key: "{{ docker_repo_url }}/ubuntu/gpg" - -# If "https://download.docker.com/linux/pop!_os/....." ever exists, this can be removed. -docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/ubuntu {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" From a6bab2c9bed848d155eb08b7d644887472193942 Mon Sep 17 00:00:00 2001 From: Dale Anderson Date: Fri, 30 Dec 2022 15:46:38 -0800 Subject: [PATCH 03/10] Make naming more consistent --- defaults/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6f3fd6f..e0fca24 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,13 +29,13 @@ docker_compose_path: /usr/local/bin/docker-compose # Docker repo URL. docker_repo_url: https://download.docker.com/linux -# Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed. +# Used only for Debian/Ubuntu/Pop!_OS. Switch 'stable' to 'nightly' if needed. docker_apt_release_channel: stable -docker_apt_ansible_distro_name: "{{ 'ubuntu' if ansible_distribution == 'Pop!_OS' else ansible_distribution }}" +docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution == 'Pop!_OS' else ansible_distribution }}" # If Docker ever officially supports Pop!_OS, this can be removed. docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" -docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ docker_apt_ansible_distro_name | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true -docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distro_name | lower }}/gpg" +docker_apt_gpg_key: "{{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }}/gpg" # Used only for RedHat/CentOS/Fedora. docker_yum_repo_url: "{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo" From 75b8acc62652d101585c793c17c45ababa829d0c Mon Sep 17 00:00:00 2001 From: Dale Anderson Date: Mon, 23 Jan 2023 17:40:17 -0800 Subject: [PATCH 04/10] Linux Mint is also Ubuntu under the hood Closes #334 --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index e0fca24..888df0e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -31,7 +31,7 @@ docker_repo_url: https://download.docker.com/linux # Used only for Debian/Ubuntu/Pop!_OS. Switch 'stable' to 'nightly' if needed. docker_apt_release_channel: stable -docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution == 'Pop!_OS' else ansible_distribution }}" # If Docker ever officially supports Pop!_OS, this can be removed. +docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution in ['Pop!_OS', 'Linux Mint'] else ansible_distribution }}" # Only necessary until Docker officially supports Pop!_OS and Linux Mint docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true From 26385299274196be82f3b94dce16b1f8907a57d8 Mon Sep 17 00:00:00 2001 From: Dale Anderson Date: Mon, 23 Jan 2023 17:50:49 -0800 Subject: [PATCH 05/10] Fix linter warning --- defaults/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 888df0e..5c6167f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,9 +29,11 @@ docker_compose_path: /usr/local/bin/docker-compose # Docker repo URL. docker_repo_url: https://download.docker.com/linux -# Used only for Debian/Ubuntu/Pop!_OS. Switch 'stable' to 'nightly' if needed. +# Used only for Debian/Ubuntu/Pop!_OS/Linux Mint. Switch 'stable' to 'nightly' if needed. docker_apt_release_channel: stable -docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution in ['Pop!_OS', 'Linux Mint'] else ansible_distribution }}" # Only necessary until Docker officially supports Pop!_OS and Linux Mint +# docker_apt_ansible_distribution is a workaround for Ubuntu variants which can't be identified as such by Ansible, +# and is only necessary until Docker officially supports them. +docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution in ['Pop!_OS', 'Linux Mint'] else ansible_distribution }}" docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true From d64f9afe1981a03a944c3551e8e8b3de73289688 Mon Sep 17 00:00:00 2001 From: Aram Akhavan Date: Mon, 8 Aug 2022 17:11:52 -0700 Subject: [PATCH 06/10] add filename option to apt repository add --- README.md | 1 + defaults/main.yml | 1 + tasks/setup-Debian.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 953b7dd..f4be6a0 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ The main Docker repo URL, common between Debian and RHEL systems. docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: True docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" + docker_apt_filename: "" (Used only for Debian/Ubuntu.) You can switch the channel to `nightly` if you want to use the Nightly release. diff --git a/defaults/main.yml b/defaults/main.yml index 870a94c..e9afb09 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -36,6 +36,7 @@ docker_repo_url: https://download.docker.com/linux docker_apt_release_channel: stable docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +docker_apt_filename: "" docker_apt_ignore_key_error: true docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 0abcd17..c6fe8c4 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -49,5 +49,6 @@ apt_repository: repo: "{{ docker_apt_repository }}" state: present + filename: "{{ docker_apt_filename }}" update_cache: true when: docker_add_repo | bool From c3a127134d6bde44bdd57fa1be1751f77d887614 Mon Sep 17 00:00:00 2001 From: Aram Akhavan Date: Mon, 8 Aug 2022 17:15:28 -0700 Subject: [PATCH 07/10] change default compose install to plugin, apt repository filename to docker.list --- defaults/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index e9afb09..fb44017 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,12 +15,12 @@ docker_service_enabled: true docker_restart_handler_state: restarted # Docker Compose Plugin options. -docker_install_compose_plugin: false +docker_install_compose_plugin: true docker_compose_package: docker-compose-plugin docker_compose_package_state: present # Docker Compose options. -docker_install_compose: true +docker_install_compose: false docker_compose_version: "v2.11.1" docker_compose_arch: "{{ ansible_architecture }}" docker_compose_url: "https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-linux-{{ docker_compose_arch }}" @@ -36,9 +36,9 @@ docker_repo_url: https://download.docker.com/linux docker_apt_release_channel: stable docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" -docker_apt_filename: "" docker_apt_ignore_key_error: true docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" +docker_apt_filename: "docker" # Used only for RedHat/CentOS/Fedora. docker_yum_repo_url: "{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo" From a23731506ba2f8ad7fc38b4021eace03dfca7e35 Mon Sep 17 00:00:00 2001 From: Dale Anderson Date: Thu, 10 Aug 2023 09:12:33 -0700 Subject: [PATCH 08/10] Restore snippet lost in previous conflict --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0122d14..77034eb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -38,7 +38,7 @@ docker_apt_release_channel: stable # and is only necessary until Docker officially supports them. docker_apt_ansible_distribution: "{{ 'ubuntu' if ansible_distribution in ['Pop!_OS', 'Linux Mint'] else ansible_distribution }}" docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}" -docker_apt_repository: "deb [arch={{ docker_apt_arch }}] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +docker_apt_repository: "deb [arch={{ docker_apt_arch }} signed-by=/etc/apt/trusted.gpg.d/docker.asc] {{ docker_repo_url }}/{{ docker_apt_ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" docker_apt_ignore_key_error: true docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" docker_apt_gpg_key_checksum: "sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570" From b41084ad3f51de32756417b0f0efe5ca13000dad Mon Sep 17 00:00:00 2001 From: Ed Ropple Date: Sat, 12 Aug 2023 14:47:52 -0400 Subject: [PATCH 09/10] Fix a typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 953b7dd..c3032a4 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can also specify a specific version of Docker to install using the distribut Red Hat/CentOS: `docker-{{ docker_edition }}-` (Note: you have to add this to all packages); Debian/Ubuntu: `docker-{{ docker_edition }}=` (Note: you have to add this to all packages). -You can control whether the package is installed, uninstalled, or at the latest version by setting `docker_package_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play). +You can control whether the package is installed, uninstalled, or at the latest version by setting `docker_packages_state` to `present`, `absent`, or `latest`, respectively. Note that the Docker daemon will be automatically restarted if the Docker package is updated. This is a side effect of flushing all handlers (running any of the handlers that have been notified by this and any other role up to this point in the play). docker_service_manage: true docker_service_state: started From 95d13bf2b88f78f502998154b11e0d87af72255e Mon Sep 17 00:00:00 2001 From: Rob Petti Date: Mon, 25 Sep 2023 12:59:01 -0600 Subject: [PATCH 10/10] remove runc, as it conflicts with containerd --- tasks/setup-RedHat.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index ad337c4..d49316e 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -44,6 +44,11 @@ - name: Configure containerd on RHEL 8. block: + - name: Ensure runc is not installed. + package: + name: runc + state: absent + - name: Ensure container-selinux is installed. package: name: container-selinux