mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
a5fbacb05e
4 changed files with 70 additions and 13 deletions
|
@ -13,11 +13,11 @@
|
|||
# 2021-08-12: Let's try to track the "official" init.d / update-rc.d
|
||||
# instructions ('update-rc.d -f asterisk remove') but using systemd instead,
|
||||
# to be more future-proof?
|
||||
- name: "FreePBX - Disable 'asterisk' systemd service, giving FreePBX full control during boot - similar to officially recommended 'update-rc.d -f asterisk remove' at: https://wiki.freepbx.org/display/FOP/Installing+FreePBX+16+on+Debian+10.9"
|
||||
- name: FreePBX - Disable 'asterisk' service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: asterisk
|
||||
#state: stopped
|
||||
state: stopped
|
||||
enabled: no
|
||||
|
||||
|
||||
|
@ -48,6 +48,11 @@
|
|||
- php{{ php_version }}-snmp
|
||||
- php{{ php_version }}-xml # Likewise installed in mediawiki/tasks/install.yml, moodle/tasks/install.yml, nextcloud/tasks/install.yml, wordpress/tasks/install.yml -- AND REGARDLESS dragged in later by Admin Console's use of php-pear for roles/cmdsrv/tasks/main.yml -- run 'php -m | grep -i xml' which in the end shows {libxml, SimpleXML, xml, xmlreader, xmlwriter}
|
||||
- php{{ php_version }}-zip # Likewise installed in moodle/tasks/install.yml, nextcloud/tasks/install.yml, wordpress/tasks/install.yml
|
||||
- cmake
|
||||
- make
|
||||
- gcc
|
||||
- libssl-dev
|
||||
- unixodbc-dev
|
||||
state: latest
|
||||
|
||||
# For PHP >= 8.0: phpX.Y-json is baked into PHP itself.
|
||||
|
@ -130,9 +135,9 @@
|
|||
name: "{{ asterisk_db_dbname }}" # asterisk
|
||||
encoding: utf8
|
||||
collation: utf8_general_ci
|
||||
# login_host: "{{ asterisk_db_host }}"
|
||||
# login_user: root
|
||||
# login_password: "{{ mysql_root_password }}"
|
||||
login_host: "{{ asterisk_db_host }}"
|
||||
login_user: "{{ asterisk_db_user }}"
|
||||
login_password: "{{ asterisk_db_password }}"
|
||||
state: present
|
||||
|
||||
- name: FreePBX - Add cdr MySQL db ({{ asterisk_db_cdrdbname }})
|
||||
|
@ -141,9 +146,10 @@
|
|||
encoding: utf8
|
||||
collation: utf8_general_ci
|
||||
login_host: "{{ asterisk_db_host }}"
|
||||
login_user: "{{ asterisk_db_user }}"
|
||||
login_password: "{{ asterisk_db_password }}"
|
||||
state: present
|
||||
|
||||
|
||||
- name: FreePBX - Create new php sessions dir /var/lib/php/asterisk_sessions/ - SEE 'php_value session.save_path /var/lib/php/asterisk_sessions/' IN pbx/templates/freepbx.conf.j2
|
||||
file:
|
||||
path: /var/lib/php/asterisk_sessions/
|
||||
|
@ -167,6 +173,34 @@
|
|||
group: asterisk
|
||||
create: yes
|
||||
|
||||
- name: Freepbx - Clone mariadb-connector-odbc
|
||||
git:
|
||||
repo: https://github.com/mariadb-corporation/mariadb-connector-odbc
|
||||
dest: /usr/src/mariadb-connector-odbc
|
||||
version: master
|
||||
force: yes
|
||||
depth: 1
|
||||
|
||||
- name: FreePBX - Build mariadb-connector-odbc
|
||||
command: "{{ iiab_dir }}/scripts/mk-odbc-connector"
|
||||
args:
|
||||
creates: /usr/local/lib/mariadb/libmaodbc.so
|
||||
|
||||
# http://mghadam.blogspot.com/2021/03/install-asterisk-18-freepbx-15-on.html
|
||||
- name: FreePBX - Install /etc/odbc.ini /etc/odbcinst.ini from template (root:root, 0644 by default)
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: /etc/
|
||||
with_items:
|
||||
- odbc.ini
|
||||
- odbcinst.ini
|
||||
|
||||
- name: FreePBX - Create /etc/asterisk/cdr_mysql.conf
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: /etc/asterisk/
|
||||
with_items:
|
||||
- cdr_mysql.conf
|
||||
|
||||
- name: FreePBX - 2-step install - won't run if {{ freepbx_install_dir }} already exists - CAN TAKE 3-12 MIN OR LONGER!
|
||||
command: "{{ item }}"
|
||||
|
@ -175,14 +209,14 @@
|
|||
creates: "{{ freepbx_install_dir }}" # /var/www/html/freepbx
|
||||
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 }}
|
||||
- ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }}
|
||||
|
||||
- name: "Run 'fwconsole stop' and 'killall -9 safe_asterisk' to stop both Asterisk processes -- this avoids \"Unable to run Pre-Asterisk hooks, because Asterisk is already running\" in 'journalctl -u freepbx' logs"
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- killall -9 "PM2 v4.5.0: God" # 2021-08-09: Missed by fwconsole (does this matter?)
|
||||
- fwconsole stop
|
||||
- killall -9 safe_asterisk # 2021-08-08: Stronger medicine needed for 64-bit Ubuntu Server 21.04 on RPi 4. Originally from @jvonau's PR #2912.
|
||||
- killall -9 "PM2 v4.5.0: God" # 2021-08-09: Missed by fwconsole (does this matter?)
|
||||
# - killall -9 asterisk # 2021-08-05: Also from @jvonau's PR #2912, to brute force this. In the end, above 'fwconsole stop' works more gracefully.
|
||||
# - ./start_asterisk stop # Buggy!
|
||||
# - /usr/sbin/asterisk -rx "core stop gracefully"
|
||||
|
@ -205,17 +239,13 @@
|
|||
# state: restarted
|
||||
|
||||
|
||||
- name: FreePBX - Install /etc/odbc.ini from template (root:root, 0644 by default) for CDR 'asteriskcdrdb' - in future consider compiling ODBC driver for aarch64 per http://mghadam.blogspot.com/2021/03/install-asterisk-18-freepbx-15-on.html ?
|
||||
template:
|
||||
src: odbc.ini
|
||||
dest: /etc/
|
||||
|
||||
- name: FreePBX - Install /etc/systemd/system/freepbx.service from template (root:root, 0644 by default)
|
||||
template:
|
||||
src: freepbx.service
|
||||
dest: /etc/systemd/system/
|
||||
|
||||
|
||||
# default module list https://github.com/iiab/iiab/pull/2916#issuecomment-894601522
|
||||
- name: FreePBX - Run 'fwconsole ma upgradeall' on installed FreePBX modules, e.g. 16 default modules (of about 70 total) - CAN TAKE 2 MIN OR LONGER!
|
||||
command: fwconsole ma upgradeall
|
||||
|
||||
|
|
6
roles/pbx/templates/cdr_mysql.conf
Normal file
6
roles/pbx/templates/cdr_mysql.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
[global]
|
||||
hostname = localhost
|
||||
dbname = asteriskcdrdb
|
||||
user = asterisk
|
||||
password = asterisk
|
||||
userfield=1
|
4
roles/pbx/templates/odbcinst.ini
Normal file
4
roles/pbx/templates/odbcinst.ini
Normal file
|
@ -0,0 +1,4 @@
|
|||
[MySQL]
|
||||
Description = ODBC for MySQL (MariaDB)
|
||||
Driver = /usr/local/lib/mariadb/libmaodbc.so
|
||||
FileUsage = 1
|
17
scripts/mk-odbc-connector
Executable file
17
scripts/mk-odbc-connector
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
ARCH=$(uname -m)
|
||||
mkdir /usr/src/mariadb-connector-odbc/build
|
||||
cd /usr/src/mariadb-connector-odbc/build
|
||||
if [ -f /etc/rpi-issue ]; then
|
||||
DM_DIR=/usr/lib/arm-linux-gnueabihf cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DCMAKE_C_FLAGS_RELWITHDEBINFO="-I/usr/include/mariadb -L/usr/lib"
|
||||
else
|
||||
DM_DIR=/usr/lib/$ARCH-linux-gnu cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONC_WITH_UNIT_TESTS=Off -DCMAKE_C_FLAGS_RELWITHDEBINFO="-I/usr/include/mariadb" -DWITH_SSL=OPENSSL -DCMAKE_INSTALL_PREFIX=/usr/local
|
||||
fi
|
||||
make
|
||||
make install
|
||||
|
||||
cat << EOF > /etc/ld.so.conf.d/99-iiab.conf
|
||||
/usr/local/lib/mariadb/
|
||||
EOF
|
||||
|
||||
ldconfig
|
Loading…
Add table
Reference in a new issue