From bbe5bb7c3c81273a18206d38600391168d395522 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Tue, 7 Mar 2017 15:55:58 +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: I041a044ef88aff917eeb3a618c2c08ac9ceb80fe --- tasks/horizon_apache.yml | 7 +++++++ vars/debian.yml | 3 +++ vars/redhat-7.yml | 3 +++ 3 files changed, 13 insertions(+) diff --git a/tasks/horizon_apache.yml b/tasks/horizon_apache.yml index a8045464..b0dc41b7 100644 --- a/tasks/horizon_apache.yml +++ b/tasks/horizon_apache.yml @@ -13,6 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Ensure apache log folder exists + file: + dest: "{{ horizon_apache_default_log_folder }}" + state: directory + owner: "{{ horizon_apache_default_log_owner }}" + group: "{{ horizon_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 - name: Enable apache2 modules diff --git a/vars/debian.yml b/vars/debian.yml index ba1fa60e..232e0433 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -31,6 +31,9 @@ horizon_distro_packages: - gettext horizon_apache_conf: "/etc/apache2/apache2.conf" +horizon_apache_default_log_folder: "/var/log/apache2" +horizon_apache_default_log_owner: "root" +horizon_apache_default_log_grp: "adm" horizon_apache_security_conf: "/etc/apache2/conf-available/security.conf" horizon_apache_site_available: "/etc/apache2/sites-available/openstack-dashboard.conf" diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 2a36846e..9991dff3 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -31,6 +31,9 @@ horizon_distro_packages: - which horizon_apache_conf: "/etc/httpd/conf/httpd.conf" +horizon_apache_default_log_folder: "/var/log/httpd" +horizon_apache_default_log_owner: "root" +horizon_apache_default_log_grp: "root" horizon_apache_security_conf: "{{ horizon_apache_conf }}" horizon_apache_configs: