From f0f94260c508814a64f1a71c873c7669c5ffa461 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 1 Oct 2015 17:56:38 +0200 Subject: [PATCH] library/roles/ssh-keys/tasks/non-root-ssh-keys.yml: do not try to install ssh keys if they do not exist. library/roles/tomcat-multiple-instances/handlers/main.yml: Ignore errors. --- ssh-keys/tasks/non-root-ssh-keys.yml | 13 +++++-------- tomcat-multiple-instances/defaults/main.yml | 2 ++ tomcat-multiple-instances/handlers/main.yml | 5 +++++ tomcat-multiple-instances/tasks/main.yml | 18 ++++++++++++------ 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ssh-keys/tasks/non-root-ssh-keys.yml b/ssh-keys/tasks/non-root-ssh-keys.yml index 060d7613..aa2c9b9f 100644 --- a/ssh-keys/tasks/non-root-ssh-keys.yml +++ b/ssh-keys/tasks/non-root-ssh-keys.yml @@ -1,13 +1,13 @@ --- - name: Install the ssh keys for non root users authorized_key: user={{ item.0.name }} key="{{ item.1 }}" state=present - when: non_root_users + when: + - authorized_keys is defined + - non_root_users with_subelements: - ssh_users_list - authorized_keys - tags: - - pubkeys - - ssh_keys + tags: [ "pubkeys", "ssh_keys" ] - name: Remove obsolete ssh keys if there are any authorized_key: user={{ item.0.name }} key="{{ item.1 }}" state=absent @@ -17,7 +17,4 @@ with_subelements: - ssh_users_list - authorized_keys - tags: - - pubkeys - - ssh_keys - + tags: [ "pubkeys", "ssh_keys" ] diff --git a/tomcat-multiple-instances/defaults/main.yml b/tomcat-multiple-instances/defaults/main.yml index 2c1958c6..683c5c25 100644 --- a/tomcat-multiple-instances/defaults/main.yml +++ b/tomcat-multiple-instances/defaults/main.yml @@ -30,6 +30,8 @@ tomcat_m_java_gc_opts: "-XX:+UseConcMarkSweepGC" tomcat_m_other_java_opts: "" tomcat_m_webapps_autodeploy: False tomcat_m_webapps_unpack: False +tomcat_m_start_instances: True +tomcat_m_enable_instances: True # JMX and debugging tomcat_m_enable_remote_debugging: False diff --git a/tomcat-multiple-instances/handlers/main.yml b/tomcat-multiple-instances/handlers/main.yml index 2f721cb5..79ca6f3e 100644 --- a/tomcat-multiple-instances/handlers/main.yml +++ b/tomcat-multiple-instances/handlers/main.yml @@ -3,21 +3,26 @@ service: name=tomcat-instance-'{{ item.item.http_port }}' state=restarted sleep=20 with_items: restart_needed.results when: item.changed + ignore_errors: True - name: tomcat restart instances with changed jmx config service: name=tomcat-instance-'{{ item.item.http_port }}' state=restarted sleep=20 with_items: jmx_restart_needed.results when: item.changed + ignore_errors: True - name: tomcat instances restart service: name=tomcat-instance-'{{ item.http_port }}' state=restarted sleep=20 with_items: tomcat_m_instances + ignore_errors: True - name: enable tomcat instances service: name=tomcat-instance-'{{ item.http_port }}' state=started enabled=yes sleep 20 with_items: tomcat_m_instances + ignore_errors: True - name: disable tomcat instances service: name=tomcat-instance-'{{ item.http_port }}' state=stopped enabled=no sleep 20 with_items: tomcat_m_instances + ignore_errors: True diff --git a/tomcat-multiple-instances/tasks/main.yml b/tomcat-multiple-instances/tasks/main.yml index bc127f65..adec3369 100644 --- a/tomcat-multiple-instances/tasks/main.yml +++ b/tomcat-multiple-instances/tasks/main.yml @@ -166,11 +166,17 @@ - tomcat restart instances with changed jmx config tags: [ 'tomcat', 'tomcat_instances', 'tomcat_jmx' ] -- name: Start and enable all the tomcat instances - service: name=tomcat-instance-'{{ item.http_port }}' state=started sleep=20 enabled=yes +- name: Start all the tomcat instances + service: name=tomcat-instance-'{{ item.http_port }}' state=started sleep=20 with_items: tomcat_m_instances - when: tomcat_first_install.changed - tags: - - tomcat - - tomcat_instances + when: + - tomcat_first_install.changed + - tomcat_m_start_instances + tags: [ 'tomcat', 'tomcat_instances'] + ignore_errors: True +- name: Enable all the tomcat instances + service: name=tomcat-instance-'{{ item.http_port }}' enabled=yes + with_items: tomcat_m_instances + when: tomcat_m_enable_instances + tags: [ 'tomcat', 'tomcat_instances']