You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ansible-role-nginx/tasks/setup-Debian.yml

41 lines
1.3 KiB

---
- name: Ensure APT official nginx key
apt_key:
url: 'http://nginx.org/keys/nginx_signing.key'
state: present
when: nginx_debian_repo_enabled | bool
- name: Ensure APT official nginx repository
apt_repository:
repo: 'deb http://nginx.org/packages/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx'
state: present
filename: nginx
update_cache: true
register: nginx_repo_added
when: nginx_debian_repo_enabled | bool and nginx_debian_repo_flavour == "stable"
- name: Ensure APT official nginx repository (mainline)
apt_repository:
repo: 'deb http://nginx.org/packages/mainline/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx'
state: present
filename: nginx
update_cache: true
register: nginx_repo_added
when: nginx_debian_repo_enabled | bool and nginx_debian_repo_flavour == "mainline"
- name: Ensure nginx will reinstall if the repo was just added.
apt:
name: nginx
state: absent
when: nginx_repo_added is changed
tags: ['skip_ansible_lint']
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=86400
changed_when: false
- name: Ensure nginx is installed.
apt:
name: "{{ nginx_package_name }}"
state: present
default_release: "{{ nginx_default_release }}"