From 5d9cdab42e93a8b031e5b2934dbe6013490a8ed7 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 29 Oct 2018 11:49:29 +0100 Subject: [PATCH] apache role: manage the 'ports.conf' file. --- apache/defaults/main.yml | 3 +++ apache/tasks/apache.yml | 20 +++++--------------- apache/templates/ports.conf | 3 +++ 3 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 apache/templates/ports.conf diff --git a/apache/defaults/main.yml b/apache/defaults/main.yml index 99a590de..ffd72039 100644 --- a/apache/defaults/main.yml +++ b/apache/defaults/main.yml @@ -6,6 +6,9 @@ apache_group: '{{ apache_user }}' apache_from_ppa: False apache_ppa_repo: 'ppa:ondrej/apache2' +apache_listen_ports: + - 80 + # Possible choices: event, prefork (the old ones), worker (the threaded version), itm apache_mpm_mode: worker diff --git a/apache/tasks/apache.yml b/apache/tasks/apache.yml index c088f4f8..9b809380 100644 --- a/apache/tasks/apache.yml +++ b/apache/tasks/apache.yml @@ -12,27 +12,17 @@ - is_trusty tags: [ 'apache', 'apache_additional_packages' ] -# - name: Load the required worker module -# apache2_module: name={{ item.name }} state={{ item.state }} force=yes -# with_items: '{{ apache_worker_modules }}' -# when: is_trusty -# notify: apache2 restart -# ignore_errors: True -# tags: [ 'apache', 'apache_modules', 'apache_workers_modules' ] - -# - name: Load the required modules -# apache2_module: name={{ item }} state=present force=yes -# with_items: '{{ apache_default_modules }}' -# notify: apache2 reload -# ignore_errors: True -# tags: [ 'apache', 'apache_modules' ] - - name: Install the apache additional packages, if any apt: pkg={{ item }} state={{ apache_pkg_state }} update_cache=yes cache_valid_time=3600 with_items: '{{ apache_additional_packages_list }}' when: apache_additional_packages tags: [ 'apache', 'apache_additional_packages' ] +- name: Instal the ports conf file + template: src=ports.conf dest=/etc/apache2/ports.conf + notify: apache2 reload + tags: [ 'apache', 'apache_conf' ] + - name: Remove the default virtualhost file file: dest=/etc/apache2/sites-enabled/{{ item }} state=absent with_items: diff --git a/apache/templates/ports.conf b/apache/templates/ports.conf new file mode 100644 index 00000000..bc9e42fc --- /dev/null +++ b/apache/templates/ports.conf @@ -0,0 +1,3 @@ +{% for port in apache_listen_ports %} +Listen {{ port }} +{% endfor %}