-
Notifications
You must be signed in to change notification settings - Fork 7
/
getEnv.yaml
28 lines (27 loc) · 1.24 KB
/
getEnv.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- name: Find our modsecurity.so Module
find: paths="/etc/,/usr/lib/" patterns="mod_security2.so" recurse=yes follow=true
register: ModSecModulePath
- name: find out where our httpd.conf is.
find: paths="/etc/" patterns="httpd.conf" recurse=yes follow=true
register: HttpConfPath
when: ansible_os_family == 'RedHat'
- name: find out where our apache2.conf is.
find: paths="/etc/" patterns="apache2.conf" recurse=yes follow=true
register: HttpConfPath
when: ansible_os_family == 'Debian'
- name: extract Path for ModSecModule
set_fact:
ModSecModulePath: "{{ ModSecModulePath[\"files\"][0][\"path\"] }}"
HttpConfPath: "{{ HttpConfPath[\"files\"][0][\"path\"] }}"
foundData: True
when: ModSecModulePath["matched"] == 1 and HttpConfPath["matched"] == 1
- name: Check to make sure we have data
fail: msg="We were unable to locate the httpd conf path or ModSec module path"
when: foundData is not defined or foundData != 1
- name: find the ServerRoot
shell: 'cat {{HttpConfPath}} | grep -o "^#*ServerRoot\s\".*\"$" | grep -o \".*\" | tr -d "\""'
register: HttpServerRoot
- name: Extract HTTP Server Root
set_fact:
HttpServerRoot: "{{ HttpServerRoot[\"stdout\"] }}"