ansible-role-nginx/tasks/main.yml
2020-07-30 12:47:08 +02:00

96 lines
3.5 KiB
YAML

---
- name: "(Setup: All OSs) Setup Prerequisites"
include_tasks: "{{ role_path }}/tasks/prerequisites/setup-{{ ansible_os_family | lower }}.yml"
tags: nginx_prerequisites
- name: "(Setup: All OSs) Setup Keys"
import_tasks: keys/setup-keys.yml
when:
- ansible_os_family == "Alpine"
or ansible_os_family == "Debian"
or ansible_os_family == "RedHat"
or ansible_os_family == "Suse"
- nginx_install_from == "nginx_repository"
or nginx_amplify_enable
or nginx_unit_enable
tags: nginx_key
- name: "(Install/Config: All OSs) Install and Configure NGINX"
block:
- name: "(Install: All OSs) Install NGINX"
block:
- name: "(Install: All OSs) Install NGINX Open Source"
include_tasks: "{{ role_path }}/tasks/opensource/install-oss.yml"
when: nginx_type == "opensource"
tags: nginx_install_oss
- name: "(Install: All OSs) Install NGINX Plus"
include_tasks: "{{ role_path }}/tasks/plus/install-plus.yml"
when: nginx_type == "plus"
tags: nginx_install_plus
- name: "(Install: All OSs) Install NGINX Modules"
include_tasks: "{{ role_path }}/tasks/modules/install-modules.yml"
when: true in nginx_modules.values()
tags: nginx_install_modules
- name: "(Install: All OSs) Delete NGINX Plus License"
include_tasks: "{{ role_path }}/tasks/plus/delete-license.yml"
when:
- nginx_type == "plus"
- nginx_delete_license
tags: nginx_delete_license
when: nginx_install | bool
- name: "(Config: All OSs) Configure NGINX"
block:
- name: "(Config: All OSs) Cleanup NGINX Config"
include_tasks: "{{ role_path }}/tasks/conf/cleanup-config.yml"
when: nginx_cleanup_config | bool
tags: nginx_cleanup_config
- name: "(Config: All OSs) Upload NGINX Config"
include_tasks: "{{ role_path }}/tasks/conf/upload-config.yml"
when: nginx_main_upload_enable
or nginx_http_upload_enable
or nginx_stream_upload_enable
or nginx_html_upload_enable
or nginx_ssl_upload_enable
tags: nginx_upload_config
- name: "(Config: All OSs) Create NGINX Config"
include_tasks: "{{ role_path }}/tasks/conf/template-config.yml"
when: nginx_main_template_enable
or nginx_http_template_enable
or nginx_stream_template_enable
or nginx_rest_api_enable
tags: nginx_template_config
when: nginx_configure | bool
- name: "(Config: All OSs) Ensure NGINX is Running"
meta: flush_handlers
- name: "(Config: All OSs) Debug Output"
include_tasks: "{{ role_path }}/tasks/conf/debug-output.yml"
when: nginx_debug_output | bool
tags: nginx_debug_output
- name: "(Config: All OSs): Configure Logrotate"
include_tasks: "{{ role_path }}/tasks/conf/logrotate.yml"
when: nginx_logrotate_conf_enable | bool
tags: nginx_logrotate_config
when: nginx_enable | bool
- name: "(Install: All OSs) Install NGINX Amplify"
include_tasks: "{{ role_path }}/tasks/amplify/install-amplify.yml"
when:
- nginx_amplify_enable | bool
- nginx_amplify_api_key is defined
- nginx_amplify_api_key | length > 0
tags: nginx_install_amplify
- name: "(Install: All OSs) Install NGINX Unit"
include_tasks: "{{ role_path }}/tasks/unit/install-unit.yml"
when: nginx_unit_enable | bool
tags: nginx_install_unit