Improve config cleanup tasks (#262)
This commit is contained in:
parent
7822449f25
commit
8ef117145f
@ -86,8 +86,11 @@ nginx_modules:
|
||||
xslt: false
|
||||
|
||||
# Remove previously existing NGINX configuration files.
|
||||
# Use a list of paths you wish to remove.
|
||||
# You can specify a list of paths you wish to remove.
|
||||
# Alternatively you can also choose whether to recurse through the paths specified.
|
||||
# Default is false.
|
||||
nginx_cleanup_config: false
|
||||
nginx_cleanup_config_path:
|
||||
- directory:
|
||||
- /etc/nginx/conf.d
|
||||
recurse: false
|
||||
|
@ -1,10 +0,0 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: "Test NGINX is installed"
|
||||
assert:
|
||||
- name: "Test NGINX service is running and enabled"
|
||||
assert:
|
||||
- name: "Test NGINX is listening"
|
||||
assert:
|
@ -6,6 +6,12 @@
|
||||
vars:
|
||||
nginx_debug_output: true
|
||||
|
||||
nginx_cleanup_config: true
|
||||
nginx_cleanup_config_path:
|
||||
- directory:
|
||||
- /etc/nginx/conf.d
|
||||
recurse: false
|
||||
|
||||
nginx_modules:
|
||||
njs: true
|
||||
perl: true
|
||||
|
@ -22,9 +22,3 @@ def test_hosts_file(host):
|
||||
assert ngx.exists
|
||||
assert ngx.user == 'root'
|
||||
assert ngx.group == 'root'
|
||||
|
||||
|
||||
def test_endpoint(host):
|
||||
command = """curl -I http://localhost/"""
|
||||
cmd = host.run(command)
|
||||
assert '200 OK' in cmd.stdout
|
||||
|
@ -1,8 +1,14 @@
|
||||
---
|
||||
- name: "(Setup: All OSs) Remove NGINX configuration files"
|
||||
- name: "(Setup: All OSs) Find NGINX Configuration Files"
|
||||
find:
|
||||
paths: "{{ item.directory }}"
|
||||
patterns: "*.conf"
|
||||
recurse: "{{ item.recurse | default(false) }}"
|
||||
loop: "{{ nginx_cleanup_config_path }}"
|
||||
register: nginx_config_files
|
||||
|
||||
- name: "(Setup: All OSs) Remove NGINX Configuration Files"
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- "{{ nginx_cleanup_config_path }}"
|
||||
notify: "(Handler: All OSs) Reload NGINX"
|
||||
loop: "{{ nginx_config_files.results | map(attribute='files') | sum(start=[]) | map(attribute='path') | list }}"
|
||||
|
Loading…
Reference in New Issue
Block a user