

- set_fact:
    nginx_package_name_default: nginx-light
  when: nginx_minimal | bool

- include: packages_backports.yml
  when: nginx_backports | bool

# TODO: install "nginx" + only necessary modules, instead of "nginx-full"

- name: Ensure Nginx is installed
  apt:
    name: "{{ nginx_package_name | default(nginx_default_package_name) }}"
    state: present
  tags:
    - nginx
    - packages

- name: Ensure nginx service is running as configured.
  service:
    name: nginx
    state: "{{ nginx_service_state }}"
    enabled: "{{ nginx_service_enabled }}"
  tags:
    - nginx
    - packages
