From 96b97ced8b722c4ff2d1a260afc642787a63c45e Mon Sep 17 00:00:00 2001 From: Andreas Lehr Date: Thu, 29 Oct 2020 12:00:34 +0100 Subject: [PATCH 1/5] use official nginx repo, remove legacy ppa --- defaults/main.yml | 6 +++--- tasks/setup-Ubuntu.yml | 30 ++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0509dbe..13ff144 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,9 +5,9 @@ nginx_default_release: "" # Used only for Redhat installation, enables source Nginx repo. nginx_yum_repo_enabled: true -# Use the official Nginx PPA for Ubuntu, and the version to use if so. -nginx_ppa_use: false -nginx_ppa_version: stable +# Use the official Nginx repositories for Ubuntu, and the version to use (stable as default, alt: mainline) +nginx_repo_use: false +nginx_repo_mainline: false # The name of the nginx package to install. nginx_package_name: "nginx" diff --git a/tasks/setup-Ubuntu.yml b/tasks/setup-Ubuntu.yml index c608d25..20dae79 100644 --- a/tasks/setup-Ubuntu.yml +++ b/tasks/setup-Ubuntu.yml @@ -4,17 +4,27 @@ name: dirmngr state: present -- name: Add PPA for Nginx (if configured). - apt_repository: - repo: 'ppa:nginx/{{ nginx_ppa_version }}' - state: present - update_cache: true - register: nginx_ppa_added - when: nginx_ppa_use | bool +- apt_repository: + repo: ppa:nginx/stable + state: absent + +- name: add nginx public key + apt_key: url=https://nginx.org/keys/nginx_signing.key + state=present + register: nginx_repo_added + when: nginx_repo_use | bool + +- name: add nginx stable repository + apt_repository: repo='deb http://nginx.org/packages/{{ '/mainline' if nginx_repo_mainline else ''}}ubuntu {{ ansible_distribution_release }} nginx' + state=present + mode=0644 + update_cache=true + register: nginx_repo_added + when: nginx_repo_use | bool -- name: Ensure nginx will reinstall if the PPA was just added. +- name: Ensure nginx will reinstall if the repo was just added. apt: name: nginx state: absent - when: nginx_ppa_added is changed - tags: ['skip_ansible_lint'] + when: nginx_repo_added is changed + tags: ['skip_ansible_lint'] \ No newline at end of file From f674c1e4b372f7d307631ce20cd2976fb35fc298 Mon Sep 17 00:00:00 2001 From: Andreas Lehr Date: Thu, 29 Oct 2020 12:03:54 +0100 Subject: [PATCH 2/5] update readme regarding ppa/official repo --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 86e6d7b..dd32f7e 100644 --- a/README.md +++ b/README.md @@ -141,10 +141,10 @@ Configures Nginx's [`log_format`](http://nginx.org/en/docs/http/ngx_http_log_mod (For Debian/Ubuntu only) Allows you to set a different repository for the installation of Nginx. As an example, if you are running Debian's wheezy release, and want to get a newer version of Nginx, you can install the `wheezy-backports` repository and set that value here, and Ansible will use that as the `-t` option while installing Nginx. - nginx_ppa_use: false - nginx_ppa_version: stable + nginx_repo_use: false + nginx_repo_mainline: false -(For Ubuntu only) Allows you to use the official Nginx PPA instead of the system's package. You can set the version to `stable` or `development`. +(For Ubuntu only) Allows you to use the official Nginx repository instead of the system's package. You can set the version to `stable` (default) or `mainline`. nginx_yum_repo_enabled: true From b5847f32d1ed16e2680752a9575736f899389820 Mon Sep 17 00:00:00 2001 From: Andreas Lehr Date: Thu, 29 Oct 2020 12:18:02 +0100 Subject: [PATCH 3/5] make travis happy --- tasks/setup-Ubuntu.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/setup-Ubuntu.yml b/tasks/setup-Ubuntu.yml index 20dae79..1a269fa 100644 --- a/tasks/setup-Ubuntu.yml +++ b/tasks/setup-Ubuntu.yml @@ -7,9 +7,9 @@ - apt_repository: repo: ppa:nginx/stable state: absent - + - name: add nginx public key - apt_key: url=https://nginx.org/keys/nginx_signing.key + apt_key: url=https://nginx.org/keys/nginx_signing.key state=present register: nginx_repo_added when: nginx_repo_use | bool @@ -27,4 +27,4 @@ name: nginx state: absent when: nginx_repo_added is changed - tags: ['skip_ansible_lint'] \ No newline at end of file + tags: ['skip_ansible_lint'] From 7cf1c985435ef74b6072d8d4e4cd820ec2f90b51 Mon Sep 17 00:00:00 2001 From: Andreas Lehr Date: Thu, 29 Oct 2020 13:42:33 +0100 Subject: [PATCH 4/5] name all tasks --- tasks/setup-Ubuntu.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tasks/setup-Ubuntu.yml b/tasks/setup-Ubuntu.yml index 1a269fa..7d0d787 100644 --- a/tasks/setup-Ubuntu.yml +++ b/tasks/setup-Ubuntu.yml @@ -4,17 +4,18 @@ name: dirmngr state: present -- apt_repository: +- name: Remove legacy ppa if present + apt_repository: repo: ppa:nginx/stable state: absent -- name: add nginx public key +- name: Add nginx public key apt_key: url=https://nginx.org/keys/nginx_signing.key state=present register: nginx_repo_added when: nginx_repo_use | bool -- name: add nginx stable repository +- name: Add nginx stable repository apt_repository: repo='deb http://nginx.org/packages/{{ '/mainline' if nginx_repo_mainline else ''}}ubuntu {{ ansible_distribution_release }} nginx' state=present mode=0644 From 14a41c5b2972a51b38f84b6f7be620d92bb95f93 Mon Sep 17 00:00:00 2001 From: Andreas Lehr Date: Mon, 18 Jan 2021 17:42:54 +0100 Subject: [PATCH 5/5] correct mainline path for Ubuntu --- tasks/setup-Ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/setup-Ubuntu.yml b/tasks/setup-Ubuntu.yml index 7d0d787..21b8bb8 100644 --- a/tasks/setup-Ubuntu.yml +++ b/tasks/setup-Ubuntu.yml @@ -16,7 +16,7 @@ when: nginx_repo_use | bool - name: Add nginx stable repository - apt_repository: repo='deb http://nginx.org/packages/{{ '/mainline' if nginx_repo_mainline else ''}}ubuntu {{ ansible_distribution_release }} nginx' + apt_repository: repo='deb http://nginx.org/packages/{{ 'mainline/' if nginx_repo_mainline else ''}}ubuntu {{ ansible_distribution_release }} nginx' state=present mode=0644 update_cache=true