From 4cf1d94e0292e049bc6df0e43976696f6855c8d0 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Apr 2023 10:02:50 -0500 Subject: [PATCH] allow in the field twiddling of pbx_use_apache post-install2 --- roles/pbx/tasks/enable-or-disable.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/pbx/tasks/enable-or-disable.yml b/roles/pbx/tasks/enable-or-disable.yml index 2b08d36d4..bc41ef919 100644 --- a/roles/pbx/tasks/enable-or-disable.yml +++ b/roles/pbx/tasks/enable-or-disable.yml @@ -3,13 +3,13 @@ - name: EITHER - Create symlink /etc/{{ apache_service }}/sites-enabled/freepbx.conf to enable Apache's http://box:{{ pbx_http_port }}/freepbx - if pbx_use_apache and pbx_enabled # http://box:83/freepbx command: a2ensite freepbx.conf - when: pbx_apache_installed is defined and pbx_enabled + when: apache_installed is defined and pbx_use_apache and pbx_enabled - name: OR ELSE - Delete symlink /etc/{{ apache_service }}/sites-enabled/freepbx.conf to disable Apache's http://box:{{ pbx_http_port }}/freepbx - if not (pbx_use_apache and pbx_enabled) file: # As 'a2dissite freepbx.conf' might not be installed path: /etc/{{ apache_service }}/sites-enabled/freepbx.conf # apache2 state: absent - when: pbx_apache_installed is defined and not pbx_enabled + when: apache_installed is defined and (not pbx_enabled or not pbx_use_apache) - name: "ENACT ABOVE SETTING FOR APACHE - 'pbx_use_apache: False' might arise later, so best ALWAYS run..." @@ -21,7 +21,7 @@ name: "{{ apache_service }}" # apache2 state: restarted enabled: yes - when: pbx_apache_installed is defined and pbx_enabled + when: apache_installed is defined and pbx_use_apache and pbx_enabled - name: OR ELSE - Stop & Disable '{{ apache_service }}' systemd service - if not (pbx_use_apache and pbx_enabled) systemd: @@ -29,7 +29,7 @@ name: "{{ apache_service }}" state: stopped enabled: no - when: pbx_apache_installed is defined and not pbx_enabled + when: apache_installed is defined and (not pbx_use_apache or not pbx_enabled) - name: Open-or-Close Asterix ports (including Apache port {{ pbx_http_port }}) in iptables firewall, depending on pbx_enabled [{{ pbx_enabled }}] in local_vars.yml - in support of './runrole pbx' command: /usr/bin/iiab-gen-iptables