2018-01-10 23:40:01 +01:00
|
|
|
---
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Check whether you are using a supported NGINX distribution
|
2020-09-15 21:27:06 +02:00
|
|
|
assert:
|
|
|
|
that: (nginx_type == "opensource" and ansible_facts['distribution'] in nginx_distributions)
|
|
|
|
or (nginx_type == "plus" and ansible_facts['distribution'] in nginx_plus_distributions)
|
|
|
|
success_msg: "Your OS, {{ ansible_facts['distribution'] }} is supported by NGINX {{ (nginx_type=='plus') | ternary('Plus', 'Open Source') }}"
|
|
|
|
fail_msg: "Your OS, {{ ansible_facts['distribution'] }} is not supported by NGINX {{ (nginx_type=='plus') | ternary('Plus', 'Open Source') }}"
|
|
|
|
when:
|
|
|
|
- nginx_install | bool
|
|
|
|
- (nginx_install_from == "nginx_repository" or nginx_type == "plus")
|
2021-06-09 17:46:49 +02:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2020-09-15 21:27:06 +02:00
|
|
|
tags: nginx_check_support
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Set up prerequisites
|
2020-09-15 21:27:06 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/prerequisites/prerequisites.yml"
|
2019-11-19 15:47:29 +01:00
|
|
|
tags: nginx_prerequisites
|
2018-08-03 00:56:25 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Set up signing keys
|
2020-09-15 21:27:06 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/keys/setup-keys.yml"
|
|
|
|
when: (nginx_install | bool and nginx_install_from == "nginx_repository")
|
2020-11-13 21:57:28 +01:00
|
|
|
or nginx_amplify_enable | bool
|
2020-06-30 18:59:53 +02:00
|
|
|
tags: nginx_key
|
2019-05-20 18:32:08 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install and Configure NGINX
|
2018-07-12 00:41:10 +02:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install NGINX
|
2020-07-22 16:19:43 +02:00
|
|
|
block:
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install NGINX Open Source
|
2020-07-22 16:19:43 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/opensource/install-oss.yml"
|
2020-07-13 18:05:03 +02:00
|
|
|
when: nginx_type == "opensource"
|
|
|
|
tags: nginx_install_oss
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Set up NGINX Plus license
|
2020-09-15 21:27:06 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/plus/setup-license.yml"
|
|
|
|
when:
|
|
|
|
- nginx_type == "plus"
|
|
|
|
- nginx_setup_license | bool
|
|
|
|
tags: nginx_setup_license
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install NGINX Plus
|
2020-11-05 15:37:40 +01:00
|
|
|
include_tasks: "{{ role_path }}/tasks/plus/install-{{ ansible_facts['os_family'] | lower }}.yml"
|
2020-07-13 18:05:03 +02:00
|
|
|
when: nginx_type == "plus"
|
|
|
|
tags: nginx_install_plus
|
|
|
|
|
2021-10-07 14:05:04 +02:00
|
|
|
- name: Install NGINX dynamic modules
|
2020-07-22 16:19:43 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/modules/install-modules.yml"
|
2020-09-08 00:44:54 +02:00
|
|
|
when:
|
|
|
|
- nginx_modules is defined
|
|
|
|
- nginx_modules | length > 0
|
2020-07-13 18:05:03 +02:00
|
|
|
tags: nginx_install_modules
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Remove NGINX Plus license
|
2020-09-15 21:27:06 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/plus/remove-license.yml"
|
2020-07-13 18:05:03 +02:00
|
|
|
when:
|
|
|
|
- nginx_type == "plus"
|
2020-09-15 21:27:06 +02:00
|
|
|
- nginx_remove_license | bool
|
|
|
|
tags: nginx_remove_license
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Modify systemd parameters
|
2020-09-15 21:27:06 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/config/modify-systemd.yml"
|
|
|
|
when:
|
|
|
|
- ansible_facts['service_mgr'] == "systemd"
|
|
|
|
- nginx_service_modify | bool
|
|
|
|
tags: nginx_modify_systemd
|
2020-07-13 18:05:03 +02:00
|
|
|
when: nginx_install | bool
|
2020-09-15 21:27:06 +02:00
|
|
|
tags: nginx_install
|
2020-07-13 18:05:03 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Ensure NGINX is running
|
2020-07-07 10:44:13 +02:00
|
|
|
meta: flush_handlers
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Debug NGINX output
|
2020-09-15 21:27:06 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/config/debug-output.yml"
|
2020-07-07 10:44:13 +02:00
|
|
|
when: nginx_debug_output | bool
|
|
|
|
tags: nginx_debug_output
|
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Configure logrotate for NGINX
|
2020-09-15 21:27:06 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/config/setup-logrotate.yml"
|
2020-07-07 10:44:13 +02:00
|
|
|
when: nginx_logrotate_conf_enable | bool
|
|
|
|
tags: nginx_logrotate_config
|
2019-05-20 18:32:08 +02:00
|
|
|
when: nginx_enable | bool
|
2018-04-09 23:21:38 +02:00
|
|
|
|
2020-09-19 17:32:17 +02:00
|
|
|
- name: Install NGINX Amplify
|
2020-07-22 16:19:43 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/amplify/install-amplify.yml"
|
2018-12-21 15:17:00 +01:00
|
|
|
when:
|
2019-05-20 18:32:08 +02:00
|
|
|
- nginx_amplify_enable | bool
|
2018-12-21 15:17:00 +01:00
|
|
|
- nginx_amplify_api_key is defined
|
2019-04-08 15:27:36 +02:00
|
|
|
- nginx_amplify_api_key | length > 0
|
2019-11-19 15:47:29 +01:00
|
|
|
tags: nginx_install_amplify
|