diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d5421e..abfdf86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/defaults/main/main.yml b/defaults/main/main.yml index c4dae20..671c9ba 100644 --- a/defaults/main/main.yml +++ b/defaults/main/main.yml @@ -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 diff --git a/handlers/main.yml b/handlers/main.yml index 8a5c72c..4d625f4 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -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 diff --git a/tasks/config/debug-output.yml b/tasks/config/debug-output.yml index b05bcab..459cbf7 100644 --- a/tasks/config/debug-output.yml +++ b/tasks/config/debug-output.yml @@ -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 diff --git a/tasks/config/modify-systemd.yml b/tasks/config/modify-systemd.yml index 649e0f8..7101ecf 100644 --- a/tasks/config/modify-systemd.yml +++ b/tasks/config/modify-systemd.yml @@ -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 diff --git a/tasks/config/setup-logrotate.yml b/tasks/config/setup-logrotate.yml index 966edb7..412ad60 100644 --- a/tasks/config/setup-logrotate.yml +++ b/tasks/config/setup-logrotate.yml @@ -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 diff --git a/tasks/keys/setup-keys.yml b/tasks/keys/setup-keys.yml index 82bf8ff..b846320 100644 --- a/tasks/keys/setup-keys.yml +++ b/tasks/keys/setup-keys.yml @@ -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 diff --git a/tasks/opensource/install-oss.yml b/tasks/opensource/install-oss.yml index 3426e8f..bbda7d5 100644 --- a/tasks/opensource/install-oss.yml +++ b/tasks/opensource/install-oss.yml @@ -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 diff --git a/tasks/plus/install-plus.yml b/tasks/plus/install-plus.yml index 33a71c7..e47349a 100644 --- a/tasks/plus/install-plus.yml +++ b/tasks/plus/install-plus.yml @@ -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 diff --git a/tasks/plus/setup-license.yml b/tasks/plus/setup-license.yml index 011e1f9..f2093ac 100644 --- a/tasks/plus/setup-license.yml +++ b/tasks/plus/setup-license.yml @@ -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 diff --git a/tasks/prerequisites/prerequisites.yml b/tasks/prerequisites/prerequisites.yml index 36ae9bb..93c0df3 100644 --- a/tasks/prerequisites/prerequisites.yml +++ b/tasks/prerequisites/prerequisites.yml @@ -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'] diff --git a/tasks/unit/install-modules.yml b/tasks/unit/install-modules.yml index ffdf113..129f1f7 100644 --- a/tasks/unit/install-modules.yml +++ b/tasks/unit/install-modules.yml @@ -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" diff --git a/tasks/unit/install-unit.yml b/tasks/unit/install-unit.yml index 559b378..9e03d7a 100644 --- a/tasks/unit/install-unit.yml +++ b/tasks/unit/install-unit.yml @@ -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"