forked from thunix/www
Cleaned up a bit
This commit is contained in:
parent
9ea257452b
commit
ad73b30665
|
@ -5,6 +5,7 @@
|
||||||
/* security */
|
/* security */
|
||||||
$access_token = '1234567890';
|
$access_token = '1234567890';
|
||||||
$lastrun = '/tmp/ansible-hook-last-run';
|
$lastrun = '/tmp/ansible-hook-last-run';
|
||||||
|
$dropfile = '/tmp/run-ansible';
|
||||||
|
|
||||||
/* get json data */
|
/* get json data */
|
||||||
$json = file_get_contents('php://input');
|
$json = file_get_contents('php://input');
|
||||||
|
@ -23,9 +24,9 @@ syslog(LOG_INFO, 'Ansible Webhook recieved.');
|
||||||
//fwrite($fs, 'DATA: '.print_r($data, true).PHP_EOL);
|
//fwrite($fs, 'DATA: '.print_r($data, true).PHP_EOL);
|
||||||
|
|
||||||
|
|
||||||
if (time()-filemtime($lastrun) > 300) {
|
if ( time () - filemtime ( $lastrun ) > 300 ) {
|
||||||
exec("/usr/bin/touch /tmp/run_ansible");
|
touch ( $dopfile );
|
||||||
touch ($lastrun);
|
touch ( $lastrun );
|
||||||
echo "HTTP 200 - Ansible webhook recieved.";
|
echo "HTTP 200 - Ansible webhook recieved.";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue