From 1fc741913f80c885e9b9bde889a6dafe57c84dd4 Mon Sep 17 00:00:00 2001 From: ThomasC Date: Mon, 12 Oct 2020 11:33:04 +0200 Subject: [PATCH] ajout verif status et fonction curl --- eval.sh | 1 + eval.yml | 4 ++-- functions.sh | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/eval.sh b/eval.sh index d0e9e73..61dc846 100644 --- a/eval.sh +++ b/eval.sh @@ -10,3 +10,4 @@ dirMustExist /srv/cours/logs pkgInstalled httpd serviceIsEnabled httpd serviceIsActive httpd +okIfCurl http://localhost/config "strong>MPM Name" diff --git a/eval.yml b/eval.yml index 5286e45..788f00b 100644 --- a/eval.yml +++ b/eval.yml @@ -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 diff --git a/functions.sh b/functions.sh index 151735f..6e826f6 100644 --- a/functions.sh +++ b/functions.sh @@ -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 +}