Improve config cleanup tasks (#262)
This commit is contained in:
parent
7822449f25
commit
8ef117145f
@ -86,8 +86,11 @@ nginx_modules:
|
|||||||
xslt: false
|
xslt: false
|
||||||
|
|
||||||
# Remove previously existing NGINX configuration files.
|
# 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.
|
# Default is false.
|
||||||
nginx_cleanup_config: false
|
nginx_cleanup_config: false
|
||||||
nginx_cleanup_config_path:
|
nginx_cleanup_config_path:
|
||||||
|
- directory:
|
||||||
- /etc/nginx/conf.d
|
- /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:
|
vars:
|
||||||
nginx_debug_output: true
|
nginx_debug_output: true
|
||||||
|
|
||||||
|
nginx_cleanup_config: true
|
||||||
|
nginx_cleanup_config_path:
|
||||||
|
- directory:
|
||||||
|
- /etc/nginx/conf.d
|
||||||
|
recurse: false
|
||||||
|
|
||||||
nginx_modules:
|
nginx_modules:
|
||||||
njs: true
|
njs: true
|
||||||
perl: true
|
perl: true
|
||||||
|
@ -22,9 +22,3 @@ def test_hosts_file(host):
|
|||||||
assert ngx.exists
|
assert ngx.exists
|
||||||
assert ngx.user == 'root'
|
assert ngx.user == 'root'
|
||||||
assert ngx.group == '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:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items:
|
loop: "{{ nginx_config_files.results | map(attribute='files') | sum(start=[]) | map(attribute='path') | list }}"
|
||||||
- "{{ nginx_cleanup_config_path }}"
|
|
||||||
notify: "(Handler: All OSs) Reload NGINX"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user