use official nginx repo, remove legacy ppa

pull/207/head
Andreas Lehr 4 years ago
parent 73b0585715
commit 96b97ced8b
  1. 6
      defaults/main.yml
  2. 30
      tasks/setup-Ubuntu.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"

@ -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']