apache: install save_apache_status.sh

This commit is contained in:
Jérémy Lecour 2017-10-07 11:55:02 +02:00
parent 2395777194
commit be84ab434e
3 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,18 @@
#!/bin/bash
set -e
DIR="/var/log/apache-status"
URL="http://127.0.0.1/server-status"
TS=`date +%Y%m%d%H%M%S`
FILE="${DIR}/${TS}.html"
mkdir -p "${DIR}"
wget -q -O "${FILE}" "${URL}"
chmod 640 "${FILE}"
find "${DIR}" -type f -mtime +1 -delete
exit 0

View file

@ -127,6 +127,15 @@
tags:
- apache
- include: remount_usr_rw.yml
- name: "Install save_apache_status.sh"
copy:
src: save_apache_status.sh
dest: /usr/share/scripts/save_apache_status.sh
mode: "0755"
force: no
- include: log2mail.yml
when: apache_log2mail_include

View file

@ -0,0 +1,15 @@
---
- name: Get mount options for partitions
shell: "mount | grep 'on /usr type'"
args:
warn: no
register: mount
changed_when: False
failed_when: False
when: not ansible_check_mode
- name: Remount /usr if it is a partition and it is not mounted in rw
command: "mount -o remount,rw /usr"
when: mount.rc == 0 and not mount.stdout_lines.0 | search("rw")
args:
warn: no