ajout verif status et fonction curl

This commit is contained in:
2020-10-12 11:33:04 +02:00
parent 3ae8be8438
commit 1fc741913f
3 changed files with 11 additions and 2 deletions

View File

@@ -10,3 +10,4 @@ dirMustExist /srv/cours/logs
pkgInstalled httpd
serviceIsEnabled httpd
serviceIsActive httpd
okIfCurl http://localhost/config "strong>MPM Name"

View File

@@ -1,6 +1,6 @@
---
- hosts:
- b2
- all
user: root
gather_facts: false
vars:
@@ -10,7 +10,7 @@
- name: insert header
lineinfile:
path: "{{ result_file }}"
line: "machine\tuser\tconffile\twebdir\tlogdir\tpkg\tservice enabled\tservice activated"
line: "machine\tuser\tconffile\twebdir\tlogdir\tpkg\tservice enabled\tservice activated\tmpmok"
state: present
create: true
delegate_to: localhost

View File

@@ -161,3 +161,11 @@ function serviceIsActive {
if ( systemctl is-active $1 &> /dev/null ) ; then echo -ne "1\t" ; else echo -ne "0\t" ; fi
}
# ok if output of given url contains given stuff
# arg1: url
# arg2: string
function okIfCurl {
url=$1
shift
if ( curl --silent "${url}" | grep -q "$@" ) ; then echo -ne "1\t" ; else echo -ne "0\t" ; fi
}