apache: install save_apache_status.sh
This commit is contained in:
parent
2395777194
commit
be84ab434e
18
apache/files/save_apache_status.sh
Normal file
18
apache/files/save_apache_status.sh
Normal 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
|
|
@ -127,6 +127,15 @@
|
||||||
tags:
|
tags:
|
||||||
- apache
|
- 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
|
- include: log2mail.yml
|
||||||
when: apache_log2mail_include
|
when: apache_log2mail_include
|
||||||
|
|
||||||
|
|
15
apache/tasks/remount_usr_rw.yml
Normal file
15
apache/tasks/remount_usr_rw.yml
Normal 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
|
Loading…
Reference in a new issue