From 08c900a2e3bf342eca21f2ec4a16859b49fa13d4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 23 Jun 2016 17:57:20 +0200 Subject: [PATCH] library/roles/d4s_user_services_perms: New task for the generic tomcat installation --- .../tasks/d4s-tomcat-node.yml | 19 +++++++++++++++++++ d4s_user_services_perms/tasks/main.yml | 2 ++ .../templates/README-tomcat.j2 | 7 +++++++ d4s_user_services_perms/templates/README.j2 | 4 ++-- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 d4s_user_services_perms/tasks/d4s-tomcat-node.yml create mode 100644 d4s_user_services_perms/templates/README-tomcat.j2 diff --git a/d4s_user_services_perms/tasks/d4s-tomcat-node.yml b/d4s_user_services_perms/tasks/d4s-tomcat-node.yml new file mode 100644 index 00000000..2984ea6a --- /dev/null +++ b/d4s_user_services_perms/tasks/d4s-tomcat-node.yml @@ -0,0 +1,19 @@ +--- +- name: Install the sudoers config that permits the tomcat user to restart the service + template: src=tomcat-sudoers.j2 dest=/etc/sudoers.d/tomcat-d4science owner=root group=root mode=0440 + tags: [ 'tomcat', 'd4science', 'sudo' ] + +- name: Install the script that allows the tomcat user to start and stop the service without using the full path + template: src={{ item.1 }}.j2 dest={{ item.0.user_home }}/{{ item.1 }} owner={{ item.0.user }} group={{ item.0.user }} mode=0755 + with_nested: + - '{{ tomcat_m_instances }}' + - [ 'startContainer.sh', 'stopContainer.sh' ] + tags: [ 'tomcat', 'd4science', 'sudo' ] + +- name: Install the README file that explains where the options files are placed and how start/stop the service + template: src={{ item.1 }}.j2 dest={{ item.0.user_home }}/{{ item.1 }} owner={{ item.0.user }} group={{ item.0.user }} mode=0444 + with_nested: + - '{{ tomcat_m_instances }}' + - [ 'README-tomcat' ] + tags: [ 'tomcat', 'd4science', 'd4s_readme' ] + diff --git a/d4s_user_services_perms/tasks/main.yml b/d4s_user_services_perms/tasks/main.yml index 99fb726c..fee27e5c 100644 --- a/d4s_user_services_perms/tasks/main.yml +++ b/d4s_user_services_perms/tasks/main.yml @@ -1,5 +1,7 @@ --- - include: d4s-smartgears-node.yml when: smartgears_node is defined and smartgears_node +- include: d4s-tomcat-node.yml + when: d4s_tomcat_node is defined and d4s_tomcat_node - include: d4s-basic-node.yml when: gcore_node is defined and gcore_node diff --git a/d4s_user_services_perms/templates/README-tomcat.j2 b/d4s_user_services_perms/templates/README-tomcat.j2 new file mode 100644 index 00000000..e7af2cbf --- /dev/null +++ b/d4s_user_services_perms/templates/README-tomcat.j2 @@ -0,0 +1,7 @@ +The java options are set inside /etc/default/tomcat-instance-{{ item.0.http_port }} + +The commands that start and stop the containers are: +{{ d4science_user_home }}/startContainer.sh +{{ d4science_user_home }}/stopContainer.sh + +The log files live inside /home/gcube/tomcat/logs (it's a symbolic link to {{ tomcat_m_instances_logdir_base }}/{{ item.0.http_port }}) diff --git a/d4s_user_services_perms/templates/README.j2 b/d4s_user_services_perms/templates/README.j2 index 52448f5b..542279e0 100644 --- a/d4s_user_services_perms/templates/README.j2 +++ b/d4s_user_services_perms/templates/README.j2 @@ -2,7 +2,7 @@ The java options are set inside /etc/default/tomcat-instance-{{ item.0.http_port The GHN environment variables are set inside /etc/default/tomcat-instance-{{ item.0.http_port }}.local The commands that start and stop the containers are: -/home/gcube/startContainer.sh -/home/gcube/stopContainer.sh +{{ d4science_user_home }}/startContainer.sh +{{ d4science_user_home }}/stopContainer.sh The log files live inside /home/gcube/tomcat/logs (it's a symbolic link to {{ tomcat_m_instances_logdir_base }}/{{ item.0.http_port }})