From 2207a272ebcf72932b2add28861e36bee03adbb2 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 6 Aug 2020 17:30:25 +0200 Subject: [PATCH] Group ownership to www-data for the log directory when requested. --- defaults/main.yml | 1 + tasks/main.yml | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 8b79df3..1b3bfb4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,6 +28,7 @@ tomcat_m_manager_status_r: "manager-status" tomcat_m_instances_base_path: '/var/lib/tomcat_instances' tomcat_m_instances_logdir_base: '/var/log/tomcat_instances' +tomcat_m_expose_log_directory: False tomcat_m_cache_base: '/var/cache/tomcat-instances' tomcat_m_default_user: 'tomcat{{ tomcat_version }}' tomcat_m_use_default_user: True diff --git a/tasks/main.yml b/tasks/main.yml index 701e677..fc87b8d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -36,6 +36,14 @@ file: dest={{ tomcat_m_instances_logdir_base }}/{{ item.http_port }} owner={{ item.user }} group={{ item.user }} mode='0750' state=directory with_items: '{{ tomcat_m_instances }}' register: tomcat_first_install + when: not tomcat_m_expose_log_directory + tags: [ 'tomcat', 'tomcat_instances', 'tomcat_log_dir' ] + +- name: Create log dirs, readable by the user that runs the http service + file: dest={{ tomcat_m_instances_logdir_base }}/{{ item.http_port }} owner={{ item.user }} group='www-data' mode='0750' state=directory + with_items: '{{ tomcat_m_instances }}' + register: tomcat_first_install + when: tomcat_m_expose_log_directory tags: [ 'tomcat', 'tomcat_instances', 'tomcat_log_dir' ] - name: Create the instances work dirs