From 5eec6ef54e518a77a0f349f60ac4cf5e9aa97006 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 22 Feb 2021 16:13:21 -0600 Subject: [PATCH 01/11] Make ansible-lint work again. --- .ansible-lint | 5 +++-- .github/workflows/ci.yml | 2 +- .gitignore | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index affe64f..2cd8c9f 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,3 +1,4 @@ skip_list: - - '306' - - '106' + - 'yaml' + - 'risky-shell-pipe' + - 'role-name' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a2fe4a..97183e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: python-version: '3.x' - name: Install test dependencies. - run: pip3 install yamllint ansible-lint + run: pip3 install yamllint ansible ansible-lint - name: Lint code. run: | diff --git a/.gitignore b/.gitignore index f56f5b5..8840c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.retry */__pycache__ *.pyc +.cache + From a977b06b7bbaeae718b6163e36147c30182a56d8 Mon Sep 17 00:00:00 2001 From: slicen Date: Fri, 12 Mar 2021 23:44:42 +1100 Subject: [PATCH 02/11] Adds option to configure docker-compose URL Necessary for installing from a local mirror or in an offline environmment. --- defaults/main.yml | 1 + tasks/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8d66047..32297f2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,6 +12,7 @@ docker_restart_handler_state: restarted # Docker Compose options. docker_install_compose: true docker_compose_version: "1.26.0" +docker_compose_url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64 docker_compose_path: /usr/local/bin/docker-compose # Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed. diff --git a/tasks/docker-compose.yml b/tasks/docker-compose.yml index 92cf4f2..27c788b 100644 --- a/tasks/docker-compose.yml +++ b/tasks/docker-compose.yml @@ -15,6 +15,6 @@ - name: Install Docker Compose (if configured). get_url: - url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64 + url: "{{ docker_compose_url }}" dest: "{{ docker_compose_path }}" mode: 0755 From c2f737d5a259e4eeb5565b685041513589ee3c89 Mon Sep 17 00:00:00 2001 From: slicen Date: Fri, 12 Mar 2021 23:47:48 +1100 Subject: [PATCH 03/11] Only fetch docker-compose if current version is not the desired version --- tasks/docker-compose.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasks/docker-compose.yml b/tasks/docker-compose.yml index 27c788b..1dee81d 100644 --- a/tasks/docker-compose.yml +++ b/tasks/docker-compose.yml @@ -1,6 +1,6 @@ --- - name: Check current docker-compose version. - command: docker-compose --version + command: "{{ docker_compose_path }} --version" register: docker_compose_current_version changed_when: false failed_when: false @@ -18,3 +18,6 @@ url: "{{ docker_compose_url }}" dest: "{{ docker_compose_path }}" mode: 0755 + when: > + docker_compose_current_version.stdout is not defined + or docker_compose_version not in docker_compose_current_version.stdout From 7c0c38ddf86d04f8086fa19c74c6e833e8e5040b Mon Sep 17 00:00:00 2001 From: slicen Date: Fri, 12 Mar 2021 23:48:54 +1100 Subject: [PATCH 04/11] Adds configuration option to point to Docker package mirror Useful in an offline environment to point to a docker.com mirror. --- defaults/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 32297f2..981218b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,17 +16,18 @@ docker_compose_url: https://github.com/docker/compose/releases/download/{{ docke docker_compose_path: /usr/local/bin/docker-compose # Used only for Debian/Ubuntu. Switch 'stable' to 'nightly' if needed. +docker_repo_url: https://download.docker.com/linux docker_apt_release_channel: stable docker_apt_arch: amd64 -docker_apt_repository: "deb [arch={{ docker_apt_arch }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}" +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: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg +docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg" # Used only for RedHat/CentOS/Fedora. -docker_yum_repo_url: https://download.docker.com/linux/{{ (ansible_distribution == "Fedora") | ternary("fedora","centos") }}/docker-{{ docker_edition }}.repo +docker_yum_repo_url: "{{ docker_repo_url }}/{{ (ansible_distribution == 'Fedora') | ternary('fedora','centos') }}/docker-{{ docker_edition }}.repo" docker_yum_repo_enable_nightly: '0' docker_yum_repo_enable_test: '0' -docker_yum_gpg_key: https://download.docker.com/linux/centos/gpg +docker_yum_gpg_key: "{{ docker_repo_url }}/centos/gpg" # A list of users who will be added to the docker group. docker_users: [] From b1704ce303623cd6f9c83d60c550257e24178d12 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Mon, 15 Mar 2021 09:27:11 -0500 Subject: [PATCH 05/11] Remove ansible-lint from roles. --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97183e2..3b61970 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,12 +29,11 @@ jobs: python-version: '3.x' - name: Install test dependencies. - run: pip3 install yamllint ansible ansible-lint + run: pip3 install yamllint - name: Lint code. run: | yamllint . - ansible-lint molecule: name: Molecule From 054e74268ee7a373f1d5b47bc882f86e1df39ddb Mon Sep 17 00:00:00 2001 From: toxinu Date: Tue, 23 Mar 2021 15:53:43 +0900 Subject: [PATCH 06/11] Do not install gnupg2 on Ubuntu 20.04 and superior --- tasks/setup-Debian.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index d701135..89c0b6d 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -11,9 +11,14 @@ name: - apt-transport-https - ca-certificates - - gnupg2 state: present +- name: Ensure gnupg2 dependency is installed. + apt: + name: gnupg2 + state: present + when: ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('20.04', '<') + - name: Add Docker apt key. apt_key: url: "{{ docker_apt_gpg_key }}" From 09df8f56889ecad264aa321f50113e408a5c3097 Mon Sep 17 00:00:00 2001 From: toxinu Date: Wed, 24 Mar 2021 11:26:04 +0900 Subject: [PATCH 07/11] Add gnupg for systems >= Ubuntu 20.04 --- tasks/setup-Debian.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 89c0b6d..f4630f9 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -13,12 +13,18 @@ - ca-certificates state: present -- name: Ensure gnupg2 dependency is installed. +- name: Ensure additionnal dependencies are installed (on Ubuntu < 20.04 and any other systems). apt: name: gnupg2 state: present when: ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('20.04', '<') +- name: Ensure additionnal dependencies are installed (on Ubuntu >= 20.04). + apt: + name: gnupg + state: present + when: ansible_distribution == 'Ubuntu' or ansible_distribution_version is version('20.04', '>=') + - name: Add Docker apt key. apt_key: url: "{{ docker_apt_gpg_key }}" From d061f2fefa5ffbf693a2117769b0103a720e17a4 Mon Sep 17 00:00:00 2001 From: Volker Thiel <568497+riker09@users.noreply.github.com> Date: Fri, 26 Mar 2021 10:19:45 +0100 Subject: [PATCH 08/11] Fixed typo in log message --- tasks/setup-Debian.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index f4630f9..cb1645b 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -13,13 +13,13 @@ - ca-certificates state: present -- name: Ensure additionnal dependencies are installed (on Ubuntu < 20.04 and any other systems). +- name: Ensure additional dependencies are installed (on Ubuntu < 20.04 and any other systems). apt: name: gnupg2 state: present when: ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('20.04', '<') -- name: Ensure additionnal dependencies are installed (on Ubuntu >= 20.04). +- name: Ensure additional dependencies are installed (on Ubuntu >= 20.04). apt: name: gnupg state: present From 150a7ce13573ccd386d55a8b1ebb3a6fed8d159f Mon Sep 17 00:00:00 2001 From: Eric Engstrom Date: Tue, 20 Apr 2021 11:16:09 -0500 Subject: [PATCH 09/11] ignore likely errors if in `ansible_check_mode` --- handlers/main.yml | 1 + tasks/main.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/handlers/main.yml b/handlers/main.yml index 7847bc1..a173b0d 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,3 +1,4 @@ --- - name: restart docker service: "name=docker state={{ docker_restart_handler_state }}" + ignore_errors: "{{ ansible_check_mode }}" diff --git a/tasks/main.yml b/tasks/main.yml index 56449ef..dd90c22 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -16,6 +16,7 @@ name: docker state: "{{ docker_service_state }}" enabled: "{{ docker_service_enabled }}" + ignore_errors: "{{ ansible_check_mode }}" - name: Ensure handlers are notified now to avoid firewall conflicts. meta: flush_handlers From 67ad58097ca473629abfea0c5c0217032c2563ff Mon Sep 17 00:00:00 2001 From: Robin Opletal <49439044+fourstepper@users.noreply.github.com> Date: Sun, 16 May 2021 11:31:51 +0200 Subject: [PATCH 10/11] Update ci.yml Fedora 34 is out - let's use that for testing from now on --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b61970..7832b05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - ubuntu1804 - debian10 - debian9 - - fedora33 + - fedora34 steps: - name: Check out the codebase. From cc1171a9f779b4ad148b3f61c3e81c42d6294143 Mon Sep 17 00:00:00 2001 From: Eric Engstrom Date: Wed, 19 May 2021 11:38:08 -0500 Subject: [PATCH 11/11] Add check and ignore installation errors in `--check` mode - addresses #280 --- tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/main.yml b/tasks/main.yml index dd90c22..d9c3b44 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -10,6 +10,7 @@ name: "{{ docker_package }}" state: "{{ docker_package_state }}" notify: restart docker + ignore_errors: "{{ ansible_check_mode }}" - name: Ensure Docker is started and enabled at boot. service: