From 15725b712800a9de36f8eb27f8ee8f4260648835 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Tue, 7 Mar 2017 11:14:33 +0000 Subject: [PATCH] Ensure the log folder exists Restarting the apache service under ubuntu read the envvars file. This envvars contains the folder for logrotate. If the folder doesn't exist or hasn't the apache permissions, the restart of the service will fail. We ensure here the folder properly exists, with the right permissions. Change-Id: I4abf785f6d3d8ca4a5fc3c9520d046618cf6f380 --- tasks/keystone_apache.yml | 7 +++++++ vars/redhat-7.yml | 3 +++ vars/ubuntu-16.04.yml | 3 +++ 3 files changed, 13 insertions(+) diff --git a/tasks/keystone_apache.yml b/tasks/keystone_apache.yml index d4e320bb..26e09b1a 100644 --- a/tasks/keystone_apache.yml +++ b/tasks/keystone_apache.yml @@ -25,6 +25,13 @@ system: "yes" shell: "/bin/false" +- name: Ensure apache log folder exists + file: + dest: "{{ keystone_apache_default_log_folder }}" + state: directory + owner: "{{ keystone_apache_default_log_owner }}" + group: "{{ keystone_apache_default_log_grp }}" + ## Workaround for https://github.com/ansible/ansible-modules-core/issues/5328 ## TODO: Replace using apache2_module when fixed in Ansible release ## NOTE(cloudnull): diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 0e75c71d..abae8946 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -58,6 +58,9 @@ keystone_apache_default_sites: - "/etc/httpd/conf.d/ssl.conf" keystone_apache_conf: "/etc/httpd/conf/httpd.conf" +keystone_apache_default_log_folder: "/var/log/httpd" +keystone_apache_default_log_owner: "root" +keystone_apache_default_log_grp: "root" keystone_apache_security_conf: "{{ keystone_apache_conf }}" keystone_apache_configs: diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index 53560a75..8361832e 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -58,6 +58,9 @@ keystone_apache_default_sites: keystone_apache_site_available: "/etc/apache2/sites-available/keystone-httpd.conf" keystone_apache_site_enabled: "/etc/apache2/sites-enabled/keystone-httpd.conf" keystone_apache_conf: "/etc/apache2/apache2.conf" +keystone_apache_default_log_folder: "/var/log/apache2" +keystone_apache_default_log_owner: "root" +keystone_apache_default_log_grp: "adm" keystone_apache_security_conf: "/etc/apache2/conf-available/security.conf" keystone_apache_configs: