diff --git a/apache/tasks/apache.yml b/apache/tasks/apache.yml index 9d4b4070..d8beb3cb 100644 --- a/apache/tasks/apache.yml +++ b/apache/tasks/apache.yml @@ -34,9 +34,11 @@ - name: Ensure that the apache service is enabled and started service: name=apache2 state=started enabled=yes when: apache_service_enabled + ignore_errors: True tags: apache - name: Ensure that the apache service is disabled and stopped if we do not want it running service: name=apache2 state=stopped enabled=no when: not apache_service_enabled + ignore_errors: True tags: apache diff --git a/nginx/defaults/main.yml b/nginx/defaults/main.yml index b6000f04..0cd1fe22 100644 --- a/nginx/defaults/main.yml +++ b/nginx/defaults/main.yml @@ -3,7 +3,7 @@ nginx_use_ldap_pam_auth: False nginx_pam_svc_name: nginx nginx_ldap_uri: "ldap://ldap.sub.research-infrastructures.eu" nginx_ldap_base_dn: "dc=research-infrastructures,dc=eu" -nginx_enabled: "Yes" +nginx_enabled: True nginx_enable_compression: True nginx_gzip_vary: "on" diff --git a/nginx/tasks/nginx.yml b/nginx/tasks/nginx.yml index f5df3143..ef09fa6a 100644 --- a/nginx/tasks/nginx.yml +++ b/nginx/tasks/nginx.yml @@ -24,6 +24,14 @@ notify: Reload nginx tags: [ 'nginx', 'nginx_conf' ] -- name: Ensure that the webserver is running - service: name=nginx state=started enabled={{ nginx_enabled }} +- name: Ensure that the webserver is running and enabled at boot time + service: name=nginx state=started enabled=yes + when: nginx_enabled + ignore_errors: True + tags: nginx + +- name: Ensure that the webserver is stopped and disabled + service: name=nginx state=stopped enabled=no + when: not nginx_enabled + ignore_errors: True tags: nginx diff --git a/postgresql/tasks/manage_pg_db.yml b/postgresql/tasks/manage_pg_db.yml index 40812a6d..673fd143 100644 --- a/postgresql/tasks/manage_pg_db.yml +++ b/postgresql/tasks/manage_pg_db.yml @@ -16,5 +16,5 @@ with_items: psql_db_data when: - psql_db_data is defined - - item.roles is defined + - ( item.createdb is not defined or item.createdb ) tags: [ 'postgresql', 'postgres', 'pg_db' ]