mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
1357fbd968
23 changed files with 646 additions and 20 deletions
9
roles/0-init/README.rst
Normal file
9
roles/0-init/README.rst
Normal file
|
@ -0,0 +1,9 @@
|
|||
=============
|
||||
0-init README
|
||||
=============
|
||||
|
||||
For a higher-level view, please see `IIAB Installation <https://github.com/iiab/iiab/wiki/IIAB-Installation>`_ and http://FAQ.IIAB.IO
|
||||
|
||||
This 0th stage literally sets the stage for Internet-in-a-Box (IIAB) installation, prior to Ansible running `Stages 1-to-9 <.>`_ and then the `network <../network>`_ stage.
|
||||
|
||||
This serves to confirm low-level Ansible facts from the OS — e.g. for housekeeping tasks related to TZ (time zone), hostname, FQDN (fully-qualified domain name), unusual systemwide dependencies etc — and whether Internet is live so that IIAB installation can proceed.
|
|
@ -102,12 +102,14 @@
|
|||
# We decided to enable mysql unconditionally.
|
||||
# when: elgg_enabled or rachel_enabled or owncloud_enabled or phpmyadmin_enabled or wordpress_enabled or iiab_menu_install
|
||||
|
||||
# Late 2017: Had commented out MongoDB on a trial basis, for a more basic/lightweight Sugarizer, per https://github.com/iiab/iiab/pull/427
|
||||
- name: Turn on both vars for MongoDB if sugarizer_enabled
|
||||
set_fact:
|
||||
mongodb_install: True
|
||||
mongodb_enabled: True
|
||||
when: sugarizer_enabled
|
||||
# MongoDB is auto-included by Sugarizer as of Feb 2019, thanks to: roles/sugarizer/meta/main.yml
|
||||
#
|
||||
## Late 2017: Had commented out MongoDB on a trial basis, for a more basic/lightweight Sugarizer, per https://github.com/iiab/iiab/pull/427
|
||||
#- name: Turn on both vars for MongoDB if sugarizer_enabled
|
||||
# set_fact:
|
||||
# mongodb_install: True
|
||||
# mongodb_enabled: True
|
||||
# when: sugarizer_enabled
|
||||
|
||||
# There might be other db's
|
||||
- name: Turn on both vars for PostgreSQL if moodle_enabled or pathagar_enabled
|
||||
|
|
|
@ -57,6 +57,12 @@
|
|||
# when: owncloud_install
|
||||
# tags: owncloud
|
||||
|
||||
- name: PBX
|
||||
include_role:
|
||||
name: pbx
|
||||
when: pbx_install
|
||||
tags: pbx
|
||||
|
||||
- name: WORDPRESS
|
||||
include_role:
|
||||
name: wordpress
|
||||
|
|
|
@ -84,15 +84,15 @@
|
|||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
with_items:
|
||||
- option: name
|
||||
value: Minetest Server
|
||||
- option: description
|
||||
value: '"Minetest is an open source clone of the Minecraft building blocks game."'
|
||||
- option: minetest_world_dir
|
||||
value: "{{ minetest_world_dir }}"
|
||||
- option: minetest_port
|
||||
value: "{{ minetest_port }}"
|
||||
- option: minetest_enabled
|
||||
value: "{{ minetest_enabled }}"
|
||||
- option: minetest_world_dir
|
||||
value: "{{ minetest_world_dir }}"
|
||||
- option: name
|
||||
value: Minetest Server
|
||||
- option: description
|
||||
value: '"Minetest is an open source clone of the Minecraft building blocks game."'
|
||||
- option: minetest_world_dir
|
||||
value: "{{ minetest_world_dir }}"
|
||||
- option: minetest_port
|
||||
value: "{{ minetest_port }}"
|
||||
- option: minetest_enabled
|
||||
value: "{{ minetest_enabled }}"
|
||||
- option: minetest_world_dir
|
||||
value: "{{ minetest_world_dir }}"
|
||||
|
|
23
roles/network/README.rst
Normal file
23
roles/network/README.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
==============
|
||||
Network README
|
||||
==============
|
||||
|
||||
This is run by Ansible after it has installed the core of Internet-in-a-Box (IIAB) and its apps/services.
|
||||
|
||||
Specifically, this 'network' role is run:
|
||||
|
||||
- automatically during IIAB installation, after /opt/iiab/iiab/iiab-install has run `Stages 0-to-9 <..>`_ (thanks to `iiab-stages.yml <../../iiab-stages.yml>`_)
|
||||
- automatically by IIAB's Admin Console (http://box/admin) if you click ``Configure`` menu -> ``Install Configured Options`` — this is similar to the above, but only runs Stage 0, then Stage 4-to-9, and then finally this 'network' role/stage (thanks to `iiab-from-console.yml <../../iiab-from-console.yml>`_)
|
||||
- or manually, if you run ``cd /opt/iiab/iiab`` then `./iiab-network <../../iiab-network>`_ (which is much the same as running ``./runrole network``)
|
||||
|
||||
Many IIAB networking questions can be answered in these 2 documents:
|
||||
|
||||
- `IIAB Networking <https://github.com/iiab/iiab/wiki/IIAB-Networking>`_ is a high-level summary, that reviews IIAB's 3 modes of operation distinguishing WAN from LAN, `common ports <https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-open-ports--services>`_, DNS name resolution and some common customizations.
|
||||
- http://FAQ.IIAB.IO includes answers to common questions like:
|
||||
|
||||
- How do I provide Wi-Fi (wireless) to all my kids?
|
||||
- Can I create a Wi-Fi hotspot using an old laptop?
|
||||
- How do I change the wireless network name?
|
||||
- Can I name my server something other than http://BOX.LAN ?
|
||||
- How do I set a static IP Address?
|
||||
- Any other networking tips?
|
|
@ -10,7 +10,7 @@
|
|||
lineinfile:
|
||||
path: /etc/hosts
|
||||
regexp: '^172\.18\.96\.1'
|
||||
line: '172.18.96.1 {{ iiab_hostname }}.{{ iiab_domain }} {{ iiab_hostname }} box box.lan'
|
||||
line: '172.18.96.1 {{ iiab_hostname }}.{{ iiab_domain }} {{ iiab_hostname }} box box.lan pbx pbx.lan'
|
||||
state: present
|
||||
when: iiab_lan_iface != "none" and not installing
|
||||
|
||||
|
|
32
roles/pbx/README.rst
Normal file
32
roles/pbx/README.rst
Normal file
|
@ -0,0 +1,32 @@
|
|||
==========
|
||||
PBX README
|
||||
==========
|
||||
|
||||
This 'pbx' playbook adds `Asterisk <https://asterisk.org/>`_ and `FreePBX <https://freepbx.org/>`_ to Internet-in-a-Box (IIAB) for VoIP and SIP functionality.
|
||||
|
||||
Asterisk is a software implementation of a private branch exchange (PBX). In conjunction with suitable telephony hardware interfaces and network applications, Asterisk is used to establish and control telephone calls between telecommunication endpoints, such as customary telephone sets, destinations on the public switched telephone network (PSTN), and devices or services on Voice over Internet Protocol (VoIP) networks. Its name comes from the asterisk (*) symbol for a signal used in dual-tone multi-frequency (DTMF) dialing.
|
||||
|
||||
FreePBX is a web-based open source GUI (graphical user interface) that controls and manages Asterisk (PBX), an open source communication server.
|
||||
|
||||
Using It
|
||||
--------
|
||||
|
||||
Prior to installing IIAB, make sure your `/etc/iiab/local_vars.yml <http://wiki.laptop.org/go/IIAB/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_ contains::
|
||||
|
||||
pbx_install: True
|
||||
pbx_enabled: True
|
||||
|
||||
Optionally, you may want to enable `chan_dongle <https://github.com/wdoekes/asterisk-chan-dongle>`_, which is a channel driver for Huawei UMTS cards allowing regular voice calls over GSM. You will need to configure a dongle post-install, for it to be recognized properly::
|
||||
|
||||
asterisk_chan_dongle: True
|
||||
|
||||
After installing PBX as part of IIAB, please visit http://pbx.lan/freepbx and proceed with initial configuration — which asks you to create a login/password.
|
||||
|
||||
You can monitor the PBX service with command::
|
||||
|
||||
systemctl status freepbx
|
||||
|
||||
Attribution
|
||||
-----------
|
||||
|
||||
This 'pbx' playbook was heavily inspired by Yannik Sembritzki's `Asterisk <https://github.com/Yannik/ansible-role-asterisk>`_ and `FreePBX <https://github.com/Yannik/ansible-role-freepbx>`_ Ansible work.
|
27
roles/pbx/defaults/main.yml
Normal file
27
roles/pbx/defaults/main.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
# pbx_install: False
|
||||
# pbx_enabled: False
|
||||
# asterisk_chan_dongle: False
|
||||
|
||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||
|
||||
pbx_installed: False
|
||||
|
||||
asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/
|
||||
asterisk_src_file: asterisk-16-current.tar.gz
|
||||
asterisk_src_dir: /opt/iiab/asterisk
|
||||
|
||||
freepbx_url: http://mirror.freepbx.org/modules/packages/freepbx/
|
||||
freepbx_src_file: freepbx-15.0-latest.tgz
|
||||
freepbx_src_dir: /opt/iiab/freepbx
|
||||
freepbx_install_dir: /var/www/html/freepbx
|
||||
|
||||
asterisk_db_host: localhost
|
||||
asterisk_db_user: asterisk
|
||||
asterisk_db_dbname: asterisk
|
||||
asterisk_db_password: asterisk
|
||||
asterisk_db_cdrdbname: asteriskcdrdb
|
||||
|
||||
chan_dongle_url: https://github.com/wdoekes/asterisk-chan-dongle/archive/
|
||||
chan_dongle_src_file: master.zip
|
||||
chan_dongle_src_dir: /opt/iiab/chan_dongle
|
3
roles/pbx/meta/main.yml
Normal file
3
roles/pbx/meta/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
dependencies:
|
||||
- { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x")}
|
||||
|
151
roles/pbx/tasks/asterisk.yml
Normal file
151
roles/pbx/tasks/asterisk.yml
Normal file
|
@ -0,0 +1,151 @@
|
|||
- name: Asterisk - Install dependencies
|
||||
include: asterisk_dependencies.yml
|
||||
|
||||
- name: Asterisk - Download software to /opt/iiab/downloads
|
||||
get_url:
|
||||
url: "{{ asterisk_url }}/{{ asterisk_src_file }}"
|
||||
dest: "{{ downloads_dir }}/{{ asterisk_src_file }}"
|
||||
timeout: "{{ download_timeout }}"
|
||||
when: internet_available
|
||||
|
||||
- name: Asterisk - Check for /opt/iiab/downloads/{{ asterisk_src_file }}
|
||||
stat:
|
||||
path: "{{ downloads_dir }}/{{ asterisk_src_file }}"
|
||||
register: asterisk_src
|
||||
|
||||
- name: Asterisk - FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ asterisk_src_file }} doesn't exist
|
||||
fail:
|
||||
msg: "{ downloads_dir }}/{{ asterisk_src_file }} is REQUIRED in order to install."
|
||||
when: not asterisk_src.stat.exists
|
||||
|
||||
- name: Asterisk - Create install source directory
|
||||
file:
|
||||
path: "{{ asterisk_src_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: Asterisk - Extract source
|
||||
unarchive:
|
||||
src: "{{ downloads_dir }}/{{ asterisk_src_file }}"
|
||||
dest: "{{ asterisk_src_dir }}"
|
||||
owner: root
|
||||
group: root
|
||||
extra_opts: [--strip-components=1]
|
||||
creates: "{{ asterisk_src_dir }}/Makefile"
|
||||
|
||||
- name: Asterisk - Download mp3 decoder library into source tree
|
||||
command: "./contrib/scripts/get_mp3_source.sh"
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
creates: "addons/mp3/mpg123.h"
|
||||
|
||||
- name: Asterisk - Install aptitude (otherwise install_prereq fails?)
|
||||
package:
|
||||
name: aptitude
|
||||
state: latest
|
||||
|
||||
- name: Asterisk - Ensure all dependencies are resolved - CAN TAKE 2 MIN OR LONGER!
|
||||
shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
|
||||
- name: Asterisk - Run the configure script
|
||||
command: "./configure --with-jansson-bundled"
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
|
||||
- name: Asterisk - Run make menuselect.makeopts
|
||||
command: "make menuselect.makeopts"
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
creates: "menuselect.makeopts"
|
||||
|
||||
- name: Asterisk - Do a bit of menuselect configuration
|
||||
command: >
|
||||
menuselect/menuselect --enable app_macro --enable format_mp3
|
||||
--enable CORE-SOUNDS-EN-WAV --enable CORE-SOUNDS-EN-G722
|
||||
--enable EXTRA-SOUNDS-EN-WAV --enable EXTRA-SOUNDS-EN-G722 --enable EXTRA-SOUNDS-EN-GSM
|
||||
--disable-category MENUSELECT_MOH
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
|
||||
- name: Asterisk - Run 'make' - CAN TAKE 10 MIN OR LONGER!
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
creates: "defaults.h"
|
||||
|
||||
- name: Asterisk - Run 'make install' - CAN TAKE 3 MIN OR LONGER!
|
||||
command: make install
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
creates: "/usr/sbin/asterisk"
|
||||
|
||||
- name: Asterisk - Run 'make config'
|
||||
command: make config
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
|
||||
- name: Asterisk - Run 'make samples'
|
||||
command: make samples
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
|
||||
- name: Asterisk - Run 'ldconfig'
|
||||
shell: ldconfig
|
||||
args:
|
||||
chdir: "{{ asterisk_src_dir }}"
|
||||
|
||||
- name: Asterisk - Ensure group 'asterisk' exists
|
||||
group:
|
||||
name: asterisk
|
||||
state: present
|
||||
|
||||
- name: Asterisk - Ensure user 'asterisk' exists, and belongs to the required groups
|
||||
user:
|
||||
name: asterisk
|
||||
group: asterisk
|
||||
groups: audio,dialout
|
||||
home: "/var/lib/asterisk"
|
||||
system: yes
|
||||
append: yes
|
||||
|
||||
- name: 'Asterisk - Set ownership of 5 directories: /etc/asterisk, /var/lib/asterisk, /var/log/asterisk, /var/spool/asterisk, /usr/lib/asterisk'
|
||||
file:
|
||||
dest: "{{ item }}"
|
||||
owner: asterisk
|
||||
group: asterisk
|
||||
recurse: yes
|
||||
with_items:
|
||||
- /etc/asterisk
|
||||
- /var/lib/asterisk
|
||||
- /var/log/asterisk
|
||||
- /var/spool/asterisk
|
||||
- /usr/lib/asterisk
|
||||
|
||||
- name: Asterisk - Set default user to 'asterisk' in /etc/default/asterisk
|
||||
lineinfile:
|
||||
path: /etc/default/asterisk
|
||||
regexp: 'AST_USER='
|
||||
line: 'AST_USER="asterisk"'
|
||||
|
||||
- name: Asterisk - Set default group to 'asterisk' in /etc/default/asterisk
|
||||
lineinfile:
|
||||
path: /etc/default/asterisk
|
||||
regexp: 'AST_GROUP='
|
||||
line: 'AST_GROUP="asterisk"'
|
||||
|
||||
- name: Asterisk - Set default user to 'asterisk' in /etc/asterisk/asterisk.conf
|
||||
lineinfile:
|
||||
path: /etc/asterisk/asterisk.conf
|
||||
regexp: 'runuser ='
|
||||
line: 'runuser = asterisk'
|
||||
|
||||
- name: Asterisk - Set default group to 'asterisk' in /etc/asterisk/asterisk.conf
|
||||
lineinfile:
|
||||
path: /etc/asterisk/asterisk.conf
|
||||
regexp: 'rungroup ='
|
||||
line: 'rungroup = asterisk'
|
||||
|
||||
- name: Asterisk - Install chan_dongle
|
||||
include: chan_dongle.yml
|
||||
when: asterisk_chan_dongle
|
16
roles/pbx/tasks/asterisk_dependencies.yml
Normal file
16
roles/pbx/tasks/asterisk_dependencies.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
- name: Asterisk - Install dependencies
|
||||
package:
|
||||
name:
|
||||
- git
|
||||
- curl
|
||||
- wget
|
||||
- libnewt-dev
|
||||
- libssl-dev
|
||||
- libncurses5-dev
|
||||
- subversion
|
||||
- libsqlite3-dev
|
||||
- build-essential
|
||||
- libjansson-dev
|
||||
- libxml2-dev
|
||||
- uuid-dev
|
||||
state: latest
|
68
roles/pbx/tasks/chan_dongle.yml
Normal file
68
roles/pbx/tasks/chan_dongle.yml
Normal file
|
@ -0,0 +1,68 @@
|
|||
- name: chan_dongle - Download software to /opt/iiab/downloads
|
||||
get_url:
|
||||
url: "{{ chan_dongle_url }}/{{ chan_dongle_src_file }}"
|
||||
dest: "{{ downloads_dir }}/{{ chan_dongle_src_file }}"
|
||||
timeout: "{{ download_timeout }}"
|
||||
when: internet_available
|
||||
|
||||
- name: chan_dongle - Check for /opt/iiab/downloads/{{ chan_dongle_src_file }}
|
||||
stat:
|
||||
path: "{{ downloads_dir }}/{{ chan_dongle_src_file }}"
|
||||
register: chan_dongle_src
|
||||
|
||||
- name: chan_dongle - FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ chan_dongle_src_file }} doesn't exist
|
||||
fail:
|
||||
msg: "{ downloads_dir }}/{{ chan_dongle_src_file }} is REQUIRED in order to install."
|
||||
when: not chan_dongle_src.stat.exists
|
||||
|
||||
- name: chan_dongle - Create install source directory
|
||||
file:
|
||||
path: "{{ chan_dongle_src_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: chan_dongle - Extract source
|
||||
unarchive:
|
||||
src: "{{ downloads_dir }}/{{ chan_dongle_src_file }}"
|
||||
dest: "{{ downloads_dir }}"
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: chan_dongle - move to {{ chan_dongle_src_dir }}
|
||||
command: rsync -av {{ downloads_dir }}/asterisk-chan-dongle-master/ {{ chan_dongle_src_dir }}
|
||||
args:
|
||||
chdir: "{{ downloads_dir }}"
|
||||
|
||||
- name: chan_dongle - Run the bootstrap script
|
||||
command: "./bootstrap"
|
||||
args:
|
||||
chdir: "{{ chan_dongle_src_dir }}"
|
||||
creates: "{{ chan_dongle_src_dir }}/configure"
|
||||
|
||||
- name: chan_dongle - Find out asterisk version
|
||||
shell: asterisk -V |cut -d " " -f 2
|
||||
register: asterisk_ver
|
||||
|
||||
- name: chan_dongle - Run the configure script
|
||||
command: "./configure --with-astversion={{asterisk_ver.stdout}}"
|
||||
args:
|
||||
chdir: "{{ chan_dongle_src_dir }}"
|
||||
creates: "{{ chan_dongle_src_dir }}/Makefile"
|
||||
|
||||
- name: chan_dongle - Run 'make'
|
||||
command: make
|
||||
args:
|
||||
chdir: "{{ chan_dongle_src_dir }}"
|
||||
creates: "{{ chan_dongle_src_dir }}/chan_dongle.o"
|
||||
|
||||
- name: chan_dongle - Run 'make install'
|
||||
command: make install
|
||||
args:
|
||||
chdir: "{{ chan_dongle_src_dir }}"
|
||||
creates: "/usr/lib/asterisk/modules/chan_dongle.so"
|
||||
|
||||
- name: chan_dongle - Copy dongle.conf over
|
||||
command: cp {{ chan_dongle_src_dir }}/etc/dongle.conf /etc/asterisk/
|
||||
args:
|
||||
chdir: "{{ chan_dongle_src_dir }}"
|
||||
creates: "/etc/asterisk/dongle.conf"
|
||||
|
152
roles/pbx/tasks/freepbx.yml
Normal file
152
roles/pbx/tasks/freepbx.yml
Normal file
|
@ -0,0 +1,152 @@
|
|||
- name: FreePBX - Install dependencies
|
||||
include: freepbx_dependencies.yml
|
||||
|
||||
- name: FreePBX - Download software to /opt/iiab/downloads
|
||||
get_url:
|
||||
url: "{{ freepbx_url }}/{{ freepbx_src_file }}"
|
||||
dest: "{{ downloads_dir }}/{{ freepbx_src_file }}"
|
||||
timeout: "{{ download_timeout }}"
|
||||
when: internet_available
|
||||
|
||||
- name: FreePBX - Check for {{ downloads_dir }}/{{ freepbx_src_file }}
|
||||
stat:
|
||||
path: "{{ downloads_dir }}/{{ freepbx_src_file }}"
|
||||
register: freepbx_src
|
||||
|
||||
- name: FreePBX - FAIL (force Ansible to exit) IF {{ downloads_dir }}/{{ freepbx_src_file }} doesn't exist
|
||||
fail:
|
||||
msg: "{ downloads_dir }}/{{ freepbx_src_file }} is REQUIRED in order to install."
|
||||
when: not freepbx_src.stat.exists
|
||||
|
||||
- name: FreePBX - Create install source directory
|
||||
file:
|
||||
path: "{{ freepbx_src_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: FreePBX - Extract source
|
||||
unarchive:
|
||||
src: "{{ downloads_dir }}/{{ freepbx_src_file }}"
|
||||
dest: "{{ freepbx_src_dir }}"
|
||||
owner: root
|
||||
group: root
|
||||
extra_opts: [--strip-components=1]
|
||||
creates: "{{ freepbx_src_dir }}/install"
|
||||
|
||||
- name: FreePBX - Disable & Stop asterisk service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: asterisk
|
||||
enabled: no
|
||||
state: stopped
|
||||
|
||||
- name: FreePBX - Add mysql user
|
||||
mysql_user:
|
||||
name: "{{ asterisk_db_user }}"
|
||||
password: "{{ asterisk_db_password }}"
|
||||
priv: "{{ asterisk_db_dbname }}.*:ALL/{{ asterisk_db_cdrdbname }}.*:ALL"
|
||||
login_host: "{{ asterisk_db_host }}"
|
||||
login_user: "root"
|
||||
login_password: "{{ mysql_root_password }}"
|
||||
host: "{{ (asterisk_db_host == 'localhost') | ternary('localhost', ansible_default_ipv4.address) }}"
|
||||
state: present
|
||||
|
||||
- name: FreePBX - Add mysql db
|
||||
mysql_db:
|
||||
name: "{{ asterisk_db_dbname }}"
|
||||
encoding: utf8
|
||||
collation: utf8_general_ci
|
||||
login_host: "{{ asterisk_db_host }}"
|
||||
login_user: "root"
|
||||
login_password: "{{ mysql_root_password }}"
|
||||
state: present
|
||||
|
||||
- name: FreePBX - Add cdr mysql db
|
||||
mysql_db:
|
||||
name: "{{ asterisk_db_cdrdbname }}"
|
||||
encoding: utf8
|
||||
collation: utf8_general_ci
|
||||
login_host: "{{ asterisk_db_host }}"
|
||||
state: present
|
||||
|
||||
- name: FreePBX - Don't let freepbx take over the php sessions dir
|
||||
blockinfile:
|
||||
content: |
|
||||
[blacklist]
|
||||
directory = /var/lib/php/sessions
|
||||
marker: "; {mark} ANSIBLE MANAGED BLOCK"
|
||||
dest: /etc/asterisk/freepbx_chown.conf
|
||||
owner: asterisk
|
||||
group: asterisk
|
||||
create: yes
|
||||
|
||||
- name: FreePBX - Create php sessions directory
|
||||
file:
|
||||
path: "/var/lib/php/asterisk_sessions/"
|
||||
state: directory
|
||||
|
||||
- name: FreePBX - Set ownership for php sessions directory
|
||||
file:
|
||||
dest: "/var/lib/php/asterisk_sessions/"
|
||||
owner: asterisk
|
||||
group: asterisk
|
||||
recurse: yes
|
||||
|
||||
- name: FreePBX - Install (just run once) - CAN TAKE 2 MIN OR LONGER!
|
||||
command: "{{ item }}"
|
||||
args:
|
||||
chdir: "{{ freepbx_src_dir }}"
|
||||
creates: "{{ freepbx_install_dir }}"
|
||||
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 }}
|
||||
|
||||
- name: FreePBX - Create /etc/odbc.ini
|
||||
template:
|
||||
src: odbc.ini.j2
|
||||
dest: /etc/odbc.ini
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: FreePBX - Copy freepbx.conf
|
||||
template:
|
||||
src: freepbx.conf.j2
|
||||
dest: /etc/apache2/sites-available/freepbx.conf
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: 0644
|
||||
|
||||
- name: FreePBX - Link freepbx.conf apache file to sites-enabled
|
||||
file:
|
||||
src: /etc/apache2/sites-available/freepbx.conf
|
||||
dest: /etc/apache2/sites-enabled/freepbx.conf
|
||||
state: link
|
||||
when: pbx_enabled
|
||||
|
||||
- name: FreePBX - Unlink freepbx.conf apachefile from sites-enabled
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/freepbx.conf
|
||||
state: absent
|
||||
when: (not pbx_enabled)
|
||||
|
||||
- name: FreePBX - Copy systemd unit file
|
||||
template:
|
||||
src: freepbx.service.j2
|
||||
dest: /etc/systemd/system/freepbx.service
|
||||
mode: 755
|
||||
|
||||
- name: FreePBX - Enable and Start freepbx service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: freepbx
|
||||
enabled: yes
|
||||
state: started
|
||||
when: pbx_enabled
|
||||
|
||||
- name: FreePBX - Disable & Stop freepbx service
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: freepbx
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: (not pbx_enabled)
|
30
roles/pbx/tasks/freepbx_dependencies.yml
Normal file
30
roles/pbx/tasks/freepbx_dependencies.yml
Normal file
|
@ -0,0 +1,30 @@
|
|||
- name: FreePBX - Install dependencies
|
||||
package:
|
||||
name:
|
||||
- wget
|
||||
- git
|
||||
- unixodbc # for Asterisk CDR (Call Detail Records)
|
||||
- sudo # required by FreePBX install script
|
||||
- net-tools # required by FWConsole (command-line utility, that controls FreePBX)
|
||||
- cron # required by FreePBX UCP package (User Control Panel)
|
||||
- sox # required for CDR web-playback
|
||||
- php
|
||||
- php-pear
|
||||
- php-cgi
|
||||
- php-common
|
||||
- php-curl
|
||||
- php-mbstring
|
||||
- php-gd
|
||||
- php-mysql
|
||||
- php-gettext
|
||||
- php-bcmath
|
||||
- php-zip
|
||||
- php-xml
|
||||
- php-imap
|
||||
- php-json
|
||||
- php-snmp
|
||||
- php-fpm
|
||||
- libapache2-mod-php
|
||||
- python-mysqldb # https://github.com/Yannik/ansible-role-freepbx/blob/master/tasks/freepbx.yml#L33
|
||||
- libapache2-mpm-itk # To serve FreePBX through a VirtualHost as asterisk user
|
||||
state: latest
|
27
roles/pbx/tasks/main.yml
Normal file
27
roles/pbx/tasks/main.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
- name: Fail if nodejs_version is incorrect
|
||||
fail:
|
||||
msg: >-
|
||||
PBX: Refusing to install as nodejs_version is not 10.x. Please fix that
|
||||
(looking into /etc/iiab/local_vars.yml and
|
||||
/opt/iiab/iiab/vars/default_vars.yml) and then rerun.
|
||||
when: pbx_install and (nodejs_version != "10.x")
|
||||
|
||||
#- name: TODO: Check if asterisk and freepbx are already installed
|
||||
|
||||
- debug: # Crazy spacing below is tuned for 80-column screens
|
||||
msg: >-
|
||||
####################################################################WARNING:
|
||||
ONLY UBUNTU 18.04 AND DEBIAN 9 ARE SUPPORTED AS OF FEBRUARY 2019. Please
|
||||
assist Internet-in-a-Box communities worldwide if you can make
|
||||
Asterisk and FreePBX work on other OS's / distros, Thank
|
||||
You! http://FAQ.IIAB.IO ###############################################################################
|
||||
|
||||
- name: Install Asterisk (debuntu)
|
||||
include_tasks: asterisk.yml
|
||||
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu
|
||||
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
|
||||
|
||||
- name: Install FreePBX (debuntu)
|
||||
include_tasks: freepbx.yml
|
||||
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu
|
||||
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
|
23
roles/pbx/templates/freepbx.conf.j2
Normal file
23
roles/pbx/templates/freepbx.conf.j2
Normal file
|
@ -0,0 +1,23 @@
|
|||
<VirtualHost *:80>
|
||||
|
||||
ServerName pbx.lan
|
||||
|
||||
ServerAdmin admin@box.lan
|
||||
DocumentRoot /var/www/html/
|
||||
|
||||
<Directory {{ freepbx_install_dir }}>
|
||||
AllowOverride All
|
||||
Options Indexes FollowSymLinks
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<IfModule mpm_itk_module>
|
||||
AssignUserId asterisk asterisk
|
||||
</IfModule>
|
||||
|
||||
php_value session.save_path /var/lib/php/asterisk_sessions/
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/pbx-error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/pbx-access.log combined
|
||||
|
||||
</VirtualHost>
|
12
roles/pbx/templates/freepbx.service.j2
Normal file
12
roles/pbx/templates/freepbx.service.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=FreePBX VoIP Server
|
||||
After=mysql.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/sbin/fwconsole start
|
||||
ExecStop=/usr/sbin/fwconsole stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
8
roles/pbx/templates/odbc.ini.j2
Normal file
8
roles/pbx/templates/odbc.ini.j2
Normal file
|
@ -0,0 +1,8 @@
|
|||
[MySQL-asteriskcdrdb]
|
||||
Description=MySQL connection to 'asteriskcdrdb' database
|
||||
driver=MySQL
|
||||
server=localhost
|
||||
database=asteriskcdrdb
|
||||
Port=3306
|
||||
Socket=/var/run/mysqld/mysqld.sock
|
||||
option=3
|
|
@ -296,6 +296,12 @@ nodered_port: 1880
|
|||
nextcloud_install: False
|
||||
nextcloud_enabled: False
|
||||
|
||||
# A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX.
|
||||
# So far, supported on Ubuntu 18.x and Debian 9 ONLY. Uses Node.js 10.x
|
||||
pbx_install: False
|
||||
pbx_enabled: False
|
||||
asterisk_chan_dongle: False
|
||||
|
||||
# If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER
|
||||
wordpress_install: False
|
||||
wordpress_enabled: False
|
||||
|
@ -440,7 +446,13 @@ calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
|
|||
minetest_install: False
|
||||
minetest_enabled: False
|
||||
minetest_port: 30000
|
||||
|
||||
minetest_server_admin: Admin
|
||||
# Should only rarely change these
|
||||
minetest_server_bin: /usr/games/minetest --server
|
||||
minetest_world_dir: /library/games/minetest/worlds/world
|
||||
minetest_working_dir: /usr/share/games/minetest
|
||||
minetest_game_dir: /usr/share/games/minetest/games/minetest_game
|
||||
minetest_config_file: /etc/minetest/minetest.conf
|
||||
|
||||
# CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018:
|
||||
# - http://download.iiab.io/content/OSM/vector-tiles/
|
||||
|
|
|
@ -195,6 +195,12 @@ nodered_enabled: True
|
|||
nextcloud_install: True
|
||||
nextcloud_enabled: True
|
||||
|
||||
# A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX.
|
||||
# So far, supported on Ubuntu 18.x and Debian 9 ONLY. Uses Node.js 10.x
|
||||
pbx_install: False
|
||||
pbx_enabled: False
|
||||
asterisk_chan_dongle: False
|
||||
|
||||
# If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER
|
||||
wordpress_install: True
|
||||
wordpress_enabled: True
|
||||
|
|
|
@ -195,6 +195,12 @@ nodered_enabled: False
|
|||
nextcloud_install: True
|
||||
nextcloud_enabled: True
|
||||
|
||||
# A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX.
|
||||
# So far, supported on Ubuntu 18.x and Debian 9 ONLY. Uses Node.js 10.x
|
||||
pbx_install: False
|
||||
pbx_enabled: False
|
||||
asterisk_chan_dongle: False
|
||||
|
||||
# If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER
|
||||
wordpress_install: True
|
||||
wordpress_enabled: True
|
||||
|
|
|
@ -195,6 +195,12 @@ nodered_enabled: False
|
|||
nextcloud_install: False
|
||||
nextcloud_enabled: False
|
||||
|
||||
# A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX.
|
||||
# So far, supported on Ubuntu 18.x and Debian 9 ONLY. Uses Node.js 10.x
|
||||
pbx_install: False
|
||||
pbx_enabled: False
|
||||
asterisk_chan_dongle: False
|
||||
|
||||
# If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER
|
||||
wordpress_install: False
|
||||
wordpress_enabled: False
|
||||
|
|
|
@ -32,3 +32,10 @@ systemd_location: /lib/systemd/system
|
|||
calibre_via_debs: True
|
||||
# roles/calibre/tasks/py-installer.yml FAILS on ARM as of 2018-05-10:
|
||||
calibre_via_python: False
|
||||
|
||||
# minetest for rpi
|
||||
minetest_server_bin: /library/games/minetest/bin/minetestserver
|
||||
minetest_working_dir: /library/games/minetest
|
||||
minetest_game_dir: /library/games/minetest/games/minetest_game
|
||||
minetest_rpi_src_url: http://www.nathansalapat.com/downloads/0.4.17.1.tar.gz
|
||||
minetest_rpi_src: minetest-0.4.17.1.tar.gz
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue