From 13d224e336c721337fcae73cdda1fc3dfee63d8e Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 9 Jun 2015 16:10:27 +0200 Subject: [PATCH] library/roles/d4s_user_services_perms: Fix the generation of the start/stop scripts. Now the multiuser option is supported. --- d4s_user_services_perms/tasks/main.yml | 8 ++++---- d4s_user_services_perms/templates/startContainer.sh.j2 | 2 +- d4s_user_services_perms/templates/stopContainer.sh.j2 | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/d4s_user_services_perms/tasks/main.yml b/d4s_user_services_perms/tasks/main.yml index 5da2f27f..687eae1f 100644 --- a/d4s_user_services_perms/tasks/main.yml +++ b/d4s_user_services_perms/tasks/main.yml @@ -4,8 +4,8 @@ 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 }}.j2 dest={{ d4science_user_home }}/{{ item }} owner={{ d4science_user }} group={{ d4science_user }} mode=0755 - with_items: - - startContainer.sh - - stopContainer.sh + 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' ] diff --git a/d4s_user_services_perms/templates/startContainer.sh.j2 b/d4s_user_services_perms/templates/startContainer.sh.j2 index 37208924..2d5fa86c 100644 --- a/d4s_user_services_perms/templates/startContainer.sh.j2 +++ b/d4s_user_services_perms/templates/startContainer.sh.j2 @@ -1,5 +1,5 @@ #!/bin/bash -sudo /etc/init.d/tomcat-instance-{{ http_port }} start +sudo /etc/init.d/tomcat-instance-{{ item.0.http_port }} start exit $? diff --git a/d4s_user_services_perms/templates/stopContainer.sh.j2 b/d4s_user_services_perms/templates/stopContainer.sh.j2 index 3a5802ad..2d22e531 100644 --- a/d4s_user_services_perms/templates/stopContainer.sh.j2 +++ b/d4s_user_services_perms/templates/stopContainer.sh.j2 @@ -1,5 +1,5 @@ #!/bin/bash -sudo /etc/init.d/tomcat-instance-{{ http_port }} stop +sudo /etc/init.d/tomcat-instance-{{ item.0.http_port }} stop exit $?