1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-14 20:22:08 +00:00

freepbx.yml: /usr/sbin/asterisk -rx "core stop gracefully"

This commit is contained in:
root 2021-08-05 19:50:44 -04:00
parent d9b7b5c4ae
commit 3c41bffd63
2 changed files with 14 additions and 15 deletions

View file

@ -1,8 +1,8 @@
# 2021-08-05: Asterisk's own install_prereq (below) handles most all of these
# 2021-08-05: Asterisk's own install_prereq (below) handles essentially all of these
#- name: Asterisk - Install dependencies
# include: asterisk_dependencies.yml
- name: Install package 'libsystemd-dev' so Asterisk compiles in systemd support -- after '/* #undef HAVE_SYSTEMD */' becomes '#undef HAVE_SYSTEMD' in /opt/iiab/asterisk/include/asterisk/autoconfig.h -- per https://community.asterisk.org/t/systemctl-start-asterisk-is-fail-with-timeout/81123/3 and https://github.com/asterisk/asterisk/blob/master/contrib/systemd/asterisk.service
- name: Asterisk - Install package 'libsystemd-dev' so Asterisk compiles in imperfect-but-improving systemd support -- so '/* #undef HAVE_SYSTEMD */' becomes '#undef HAVE_SYSTEMD' in /opt/iiab/asterisk/include/asterisk/autoconfig.h -- per https://community.asterisk.org/t/systemctl-start-asterisk-is-fail-with-timeout/81123/3 and https://github.com/asterisk/asterisk/blob/master/contrib/systemd/asterisk.service
package:
name: libsystemd-dev
state: present
@ -106,12 +106,6 @@
args:
chdir: "{{ asterisk_src_dir }}"
# - name: 2021-08-05 EXPERIMENTALLY RUN 'update-rc.d -f asterisk remove' similar to 'systemctl disable asterisk' as recommended by https://wiki.freepbx.org/display/FOP/Installing+FreePBX+16+on+Debian+10.9
# command: update-rc.d -f asterisk remove
- pause:
- name: Asterisk - Ensure group 'asterisk' exists
group:

View file

@ -1,6 +1,7 @@
# https://wiki.freepbx.org/display/FOP/Installing+FreePBX+16+on+Debian+10.9
# https://computingforgeeks.com/how-to-install-asterisk-16-with-freepbx-15-on-ubuntu-debian/
# RPi: http://mghadam.blogspot.com/2021/03/install-asterisk-18-freepbx-15-on.html
# 2012-2017: http://www.raspberry-asterisk.org
- name: FreePBX - Install dependencies
include: freepbx_dependencies.yml
@ -57,6 +58,14 @@
# enabled: no
# state: stopped
# 2021-08-05: Asterisk's systemd / systemctl support is getting there but Very
# Imperfect (even when compiled in, see the top of asterisk.tml) so let's
# follow the official instructions for now:
- name: FreePBX - Run 'update-rc.d -f asterisk remove' similar to 'systemctl disable asterisk' giving FreePBX full control during boot - not strictly required but recommended by https://wiki.freepbx.org/display/FOP/Installing+FreePBX+16+on+Debian+10.9
command: update-rc.d -f asterisk remove
- name: FreePBX - Add MySQL user ({{ asterisk_db_user }})
mysql_user:
name: "{{ asterisk_db_user }}"
@ -124,11 +133,10 @@
with_items:
- ./start_asterisk start
- ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }}
- /usr/sbin/asterisk -rx "core stop gracefully" # 2021-08-05: For 1st run of enable-or-disable.yml, so 'systemctl status freepbx' doesn't show "Unable to run Pre-Asterisk hooks, because Asterisk is already running" -- allowing http://box:83/freepbx to connect to Asterix reliably/immediately -- even prior to the 1st reboot
# - ./start_asterisk stop
#- killall -9 safe_asterisk # 2021-08-05: Thanks to @jvonau's PR $2912, these 2 lines attempt a (brute force for now, not enough?!) workaround to intermittent
#- killall -9 asterisk # #2908 install issue of 'systemctl status freepbx' showing "Unable to run Pre-Asterisk hooks, because Asterisk is already running"
- pause:
# - killall -9 safe_asterisk # 2021-08-05: Thanks to @jvonau's PR $2912, these 2 lines attempt a (brute force for now, not enough?!) workaround to intermittent
# - killall -9 asterisk # #2908 install issue of 'systemctl status freepbx' showing "Unable to run Pre-Asterisk hooks, because Asterisk is already running"
# - name: 'FreePBX - fix file permissions for NGINX: /etc/freepbx.conf (0644), /var/log/asterisk/freepbx.log (0666)'
# file:
@ -172,6 +180,3 @@
path: /etc/apache2/ports.conf
line: "Listen {{ pbx_http_port }}"
# insertafter: Listen 80
- pause: