Improve the error formatting when there's a syntax error (#324)
And remove the debug tasks messages.
This commit is contained in:
parent
5c7cfb05fb
commit
8b41c27cb5
@ -1,6 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
## 0.17.0 (Unreleased)
|
||||
## 0.17.0 (September 18, 2020)
|
||||
|
||||
BREAKING CHANGES:
|
||||
|
||||
@ -10,9 +10,8 @@ BREAKING CHANGES:
|
||||
|
||||
FEATURES:
|
||||
|
||||
* Two new variables have been introduced:
|
||||
* A new variable has been introduced:
|
||||
* `nginx_setup_license` -- Determine whether you want to use this role to upload your NGINX license to your target host.
|
||||
* `nginx_debug_tasks` -- Print task related information to give you a better insight into the current progress of the role.
|
||||
* The role will now fail automatically if you try to deploy NGINX from an official repository in an unsupported distribution. You can find a list of supported distributions for NGINX and NGINX Plus in [`vars/main.yml`](https://github.com/nginxinc/ansible-role-nginx/blob/main/vars/main.yml)
|
||||
* Three new tags have been introduced -- `nginx_setup_license`, `nginx_install` and `nginx_check_support`.
|
||||
* Add Alpine 3.12 to the list of supported platforms.
|
||||
|
@ -18,8 +18,6 @@ nginx_configure: false
|
||||
# Default is true.
|
||||
nginx_start: true
|
||||
|
||||
# Print NGINX task information to terminal during playbook execution.
|
||||
nginx_debug_tasks: false
|
||||
# Print NGINX configuration file to terminal after executing playbook.
|
||||
nginx_debug_output: false
|
||||
|
||||
|
@ -6,8 +6,9 @@
|
||||
listen: "(Handler) Run NGINX"
|
||||
|
||||
- name: "(Handler) Print NGINX error if syntax check fails"
|
||||
fail:
|
||||
msg: "{{ config.stderr }}"
|
||||
debug:
|
||||
var: config.stderr_lines
|
||||
failed_when: config.rc != 0
|
||||
when: config.rc != 0
|
||||
listen: "(Handler) Run NGINX"
|
||||
|
||||
@ -30,13 +31,13 @@
|
||||
name: amplify-agent
|
||||
state: started
|
||||
|
||||
- name: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||
- name: "(DEPRECATED Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||
service:
|
||||
name: unit
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
- name: "(Handler: FreeBSD) Start NGINX Unit"
|
||||
- name: "(DEPRECATED Handler: FreeBSD) Start NGINX Unit"
|
||||
service:
|
||||
name: unitd
|
||||
state: started
|
||||
|
@ -1,11 +1,6 @@
|
||||
---
|
||||
- name: "Print NGINX config"
|
||||
debug:
|
||||
msg: "Printing NGINX config"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "Register NGINX configuration"
|
||||
command: nginx -T
|
||||
command: "nginx -T"
|
||||
changed_when: false
|
||||
register: config
|
||||
|
||||
|
@ -1,9 +1,4 @@
|
||||
---
|
||||
- name: "Modify systemd"
|
||||
debug:
|
||||
msg: "Modifying systemd"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "Create override directory for NGINX systemd service"
|
||||
file:
|
||||
path: "{{ nginx_service_overridepath }}"
|
||||
@ -40,8 +35,3 @@
|
||||
state: absent
|
||||
when: nginx_service_clean | bool
|
||||
notify: "(Handler) Systemd daemon-reload"
|
||||
|
||||
- name: "Modify systemd"
|
||||
debug:
|
||||
msg: "Done modifying systemd"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
@ -1,33 +1,28 @@
|
||||
---
|
||||
- name: "Set up logrotate"
|
||||
debug:
|
||||
msg: "Setting up logrotate"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "(Alpine Linux OSs) Install logrotate"
|
||||
- name: "(Alpine Linux) Install logrotate"
|
||||
apk:
|
||||
name: logrotate
|
||||
when: ansible_facts['os_family'] == "Alpine"
|
||||
|
||||
- name: "(Debian OSs) Install logrotate"
|
||||
- name: "(Debian/Ubuntu) Install logrotate"
|
||||
apt:
|
||||
name: logrotate
|
||||
state: present
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
|
||||
- name: "(Red Hat OSs) Install logrotate"
|
||||
- name: "(Amazon Linux/CentOS/Oracle Linux/RHEL) Install logrotate"
|
||||
yum:
|
||||
name: logrotate
|
||||
state: present
|
||||
when: ansible_facts['os_family'] == "RedHat"
|
||||
|
||||
- name: "(SLES OSs) Set up logrotate"
|
||||
- name: "(SLES) Set up logrotate"
|
||||
block:
|
||||
- name: "(SLES OSs) Configure logrotate repository"
|
||||
- name: "(SLES) Configure logrotate repository"
|
||||
zypper_repository:
|
||||
repo: https://download.opensuse.org/repositories/openSUSE:Leap:42.1/standard/openSUSE:Leap:42.1.repo
|
||||
|
||||
- name: "(SLES OSs) Install Logrotate"
|
||||
- name: "(SLES) Install Logrotate"
|
||||
zypper:
|
||||
name: logrotate
|
||||
state: present
|
||||
@ -39,8 +34,3 @@
|
||||
dest: "/etc/logrotate.d/nginx"
|
||||
mode: 0644
|
||||
notify: "(Handler) Run logrotate"
|
||||
|
||||
- name: "Set up logrotate"
|
||||
debug:
|
||||
msg: "Done setting up logrotate"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
@ -1,9 +1,4 @@
|
||||
---
|
||||
- name: "Set up signing keys"
|
||||
debug:
|
||||
msg: "Setting up signing keys"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "(Alpine Linux) Set up signing key"
|
||||
block:
|
||||
- name: "(Alpine Linux) Set up NGINX signing key URL"
|
||||
@ -34,8 +29,3 @@
|
||||
key: "{{ keysite }}"
|
||||
validate_certs: "{{ (ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}"
|
||||
when: ansible_facts['os_family'] in ['RedHat', 'Suse']
|
||||
|
||||
- name: "Set up signing keys"
|
||||
debug:
|
||||
msg: "Done setting up signing keys"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
@ -1,9 +1,4 @@
|
||||
---
|
||||
- name: "Install NGINX"
|
||||
debug:
|
||||
msg: "Installing NGINX"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "Install NGINX in Linux systems"
|
||||
block:
|
||||
- name: "Install NGINX from repository"
|
||||
@ -31,8 +26,3 @@
|
||||
- name: "Install NGINX in Unix systems"
|
||||
include_tasks: "{{ role_path }}/tasks/opensource/install-bsd.yml"
|
||||
when: ansible_facts['system'] | lower is search('bsd')
|
||||
|
||||
- name: "Install NGINX"
|
||||
debug:
|
||||
msg: "Done installing NGINX"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
@ -1,9 +1,4 @@
|
||||
---
|
||||
- name: "Install NGINX Plus"
|
||||
debug:
|
||||
msg: "Installing NGINX Plus"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "Set NGINX Plus repository"
|
||||
set_fact:
|
||||
repository: "{{ nginx_repository |
|
||||
@ -11,8 +6,3 @@
|
||||
|
||||
- name: "Install NGINX from repository"
|
||||
include_tasks: "{{ role_path }}/tasks/plus/install-{{ ansible_facts['os_family'] | lower }}.yml"
|
||||
|
||||
- name: "Install NGINX Plus"
|
||||
debug:
|
||||
msg: "Done installing NGINX Plus"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
@ -1,9 +1,4 @@
|
||||
---
|
||||
- name: "Set up NGINX Plus license"
|
||||
debug:
|
||||
msg: "Setting up NGINX Plus license"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "(Debian/Red Hat/SLES OSs) Set up NGINX Plus license"
|
||||
block:
|
||||
- name: "(Debian/Red Hat/SLES OSs) Create SSL directory"
|
||||
@ -45,8 +40,3 @@
|
||||
decrypt: yes
|
||||
mode: 0444
|
||||
when: ansible_facts['os_family'] == "Alpine"
|
||||
|
||||
- name: "Set up NGINX Plus license"
|
||||
debug:
|
||||
msg: "Done setting up NGINX Plus license"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
@ -1,24 +1,9 @@
|
||||
---
|
||||
- name: "Install dependencies"
|
||||
debug:
|
||||
msg: "Installing dependencies"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "Install dependencies"
|
||||
include_tasks: "{{ role_path }}/tasks/prerequisites/install-dependencies.yml"
|
||||
|
||||
- name: "Install dependencies"
|
||||
debug:
|
||||
msg: "Done installing dependencies"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "Set up SELinux"
|
||||
block:
|
||||
- name: "Set up SELinux"
|
||||
debug:
|
||||
msg: "Setting up SELinux"
|
||||
when: nginx_debug_tasks | bool
|
||||
|
||||
- name: "Check if SELinux is enabled"
|
||||
debug:
|
||||
msg: "You need to enable SELinux, if it was disabled you need to reboot"
|
||||
@ -27,11 +12,6 @@
|
||||
- name: "Configure SELinux"
|
||||
include_tasks: "{{ role_path }}/tasks/prerequisites/setup-selinux.yml"
|
||||
when: ansible_facts['selinux.mode'] is defined
|
||||
|
||||
- name: "Set up SELinux"
|
||||
debug:
|
||||
msg: "Done setting up SELinux"
|
||||
when: nginx_debug_tasks | bool
|
||||
when:
|
||||
- nginx_selinux | bool
|
||||
- ansible_facts['os_family'] in ['RedHat', 'Suse']
|
||||
|
@ -6,7 +6,7 @@
|
||||
state: present
|
||||
loop: "{{ nginx_unit_modules }}"
|
||||
when: ansible_facts['os_family'] != "FreeBSD"
|
||||
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||
notify: "(DEPRECATED Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||
|
||||
- name: "(FreeBSD) Install NGINX Unit Modules"
|
||||
portinstall:
|
||||
@ -14,4 +14,4 @@
|
||||
state: present
|
||||
loop: "{{ nginx_unit_modules }}"
|
||||
when: ansible_facts['os_family'] == "FreeBSD"
|
||||
notify: "(Handler: FreeBSD) Start NGINX Unit"
|
||||
notify: "(DEPRECATED Handler: FreeBSD) Start NGINX Unit"
|
||||
|
@ -15,14 +15,14 @@
|
||||
name: unit
|
||||
state: present
|
||||
when: ansible_facts['os_family'] != "FreeBSD"
|
||||
notify: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||
notify: "(DEPRECATED Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
|
||||
|
||||
- name: "(DEPRECATED) Install NGINX Unit"
|
||||
portinstall:
|
||||
name: unit
|
||||
state: present
|
||||
when: ansible_facts['os_family'] == "FreeBSD"
|
||||
notify: "(Handler: FreeBSD) Start NGINX Unit"
|
||||
notify: "(DEPRECATED Handler: FreeBSD) Start NGINX Unit"
|
||||
|
||||
- name: "(DEPRECATED) Install NGINX Unit modules"
|
||||
include_tasks: "{{ role_path }}/tasks/unit/install-modules.yml"
|
||||
|
Loading…
Reference in New Issue
Block a user