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