From 96a58f54351818595e9366399e7a5d6a0981923a Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 26 Jan 2016 19:51:14 +0100 Subject: [PATCH] library/roles/apache: Provide a way to install additional apache modules packages. --- apache/defaults/main.yml | 4 ++++ apache/tasks/apache.yml | 12 +++++++++--- tomcat-apache-requirements/tasks/packages.yml | 12 +++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/apache/defaults/main.yml b/apache/defaults/main.yml index 7dc26445..a44ae38a 100644 --- a/apache/defaults/main.yml +++ b/apache/defaults/main.yml @@ -51,6 +51,10 @@ apache_basic_auth_modules: # apache_basic_users: # - { username:'', password:'', state:'present,absent', auth_file:'path_to_file' } +# +# apache_additional_packages: +# - libapache2-mod-uwsgi +# - ... # # Set this variable to load the modules you need #apache_additional_modules: diff --git a/apache/tasks/apache.yml b/apache/tasks/apache.yml index 49bc18b3..9d4b4070 100644 --- a/apache/tasks/apache.yml +++ b/apache/tasks/apache.yml @@ -1,19 +1,25 @@ --- - name: Install the apache packages apt: pkg={{ item }} state=installed force=yes - with_items: apache_packages + with_items: '{{ apache_packages }}' tags: [ 'apache', 'apache_main_packages' ] +- name: Install the apache additional packages, if any + apt: pkg={{ item }} state=installed force=yes + with_items: '{{ apache_additional_packages }}' + when: apache_additional_packages is defined + tags: [ 'apache', 'apache_additional_packages' ] + - name: Load the required worker module apache2_module: name={{ item.name }} state={{ item.state }} - with_items: apache_worker_modules + with_items: '{{ apache_worker_modules }}' when: is_trusty notify: apache2 restart tags: [ 'apache', 'apache_modules', 'apache_workers_modules' ] - name: Load the required modules apache2_module: name={{ item }} state=present - with_items: apache_default_modules + with_items: '{{ apache_default_modules }}' notify: apache2 reload tags: [ 'apache', 'apache_modules' ] diff --git a/tomcat-apache-requirements/tasks/packages.yml b/tomcat-apache-requirements/tasks/packages.yml index a456004e..31de7ad5 100644 --- a/tomcat-apache-requirements/tasks/packages.yml +++ b/tomcat-apache-requirements/tasks/packages.yml @@ -4,15 +4,13 @@ with_items: - postgresql-client when: tomcat_install_jdbc is defined and tomcat_install_jdbc - tags: - - postgres - - postgresql + tags: [ 'postgres', 'postgresql', 'tomcat' ] - name: Install the mongodb client apt: pkg={{ item }} state=installed with_items: - mongodb-clients - when: mongodb is not defined - tags: - - mongodb - + when: + - mongodb is not defined + - install_mongodb_client is defined and install_mongodb_client + tags: [ 'mongodb', 'tomcat' ]