From f6089d991365729a9c977bc879f2b53266df5650 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 06:47:59 +0000 Subject: [PATCH 01/91] Initial stab at adding a PBX. Playbooks and necessary config for Asterisk --- roles/6-generic-apps/tasks/main.yml | 6 + roles/pbx/defaults/main.yml | 7 ++ roles/pbx/tasks/asterisk.yml | 136 ++++++++++++++++++++++ roles/pbx/tasks/asterisk_dependencies.yml | 16 +++ roles/pbx/tasks/freepbx.yml | 0 roles/pbx/tasks/main.yml | 9 ++ vars/default_vars.yml | 8 ++ vars/local_vars_big.yml | 8 ++ vars/local_vars_medium.yml | 8 ++ vars/local_vars_min.yml | 8 ++ 10 files changed, 206 insertions(+) create mode 100644 roles/pbx/defaults/main.yml create mode 100644 roles/pbx/tasks/asterisk.yml create mode 100644 roles/pbx/tasks/asterisk_dependencies.yml create mode 100644 roles/pbx/tasks/freepbx.yml create mode 100644 roles/pbx/tasks/main.yml diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 27cebdf08..2144fef7a 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -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 diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml new file mode 100644 index 000000000..11db76841 --- /dev/null +++ b/roles/pbx/defaults/main.yml @@ -0,0 +1,7 @@ +pbx_install: False +pbx_enabled: False +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 diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml new file mode 100644 index 000000000..b386226bb --- /dev/null +++ b/roles/pbx/tasks/asterisk.yml @@ -0,0 +1,136 @@ +- 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 + +- 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 - Ensure all dependencies are resolved + shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install + args: + chdir: {{ asterisk_src_dir }} + +- name: Asterisk - Run the configure script + command: "./configure" + args: + chdir:{{ asterisk_src_dir }} + +- name: Asterisk - Run make menuselect.makeopts + command: "make menuselect.makeopts" + args: + chdir:{{ asterisk_src_dir }} + +- 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' + command: make + args: + chdir:{{ asterisk_src_dir }} + +- name: Asterisk - install + command: make install + args: + chdir:{{ asterisk_src_dir }} + +- name: Asterisk - install config + command: make config + args: + chdir:{{ asterisk_src_dir }} + +- name: Asterisk - install samples + command: make samples + args: + chdir:{{ asterisk_src_dir }} + +- name: Asterisk - ldconfig + command: ldconfig + args: + chdir:{{ asterisk_src_dir }} + +- name: Asterisk - Create the necessary user/group config and set permissions + command: "{{ item }} chdir={{ asterisk_src_dir }}" + with_items: + - groupadd asterisk + - useradd -r -d /var/lib/asterisk -g asterisk asterisk + - usermod -aG audio,dialout asterisk + - chown -R asterisk.asterisk /etc/asterisk + - chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk + - chown -R asterisk.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: Enable & Start asterisk service + systemd: + daemon_reload: yes + name: asterisk + enabled: yes + state: started + when: asterisk_enabled + +- name: Disable & Stop asterisk service + systemd: + daemon_reload: yes + name: asterisk + enabled: no + state: stopped + when: (not asterisk_enabled) diff --git a/roles/pbx/tasks/asterisk_dependencies.yml b/roles/pbx/tasks/asterisk_dependencies.yml new file mode 100644 index 000000000..1191169eb --- /dev/null +++ b/roles/pbx/tasks/asterisk_dependencies.yml @@ -0,0 +1,16 @@ +- name: Install asterisk 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 diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml new file mode 100644 index 000000000..e69de29bb diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml new file mode 100644 index 000000000..2ee162686 --- /dev/null +++ b/roles/pbx/tasks/main.yml @@ -0,0 +1,9 @@ +#- name: TODO: Check if asterisk and freepbx are already installed + +- name: Install asterisk + include_tasks: asterisk.yml + when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) + +- name: Install freepbx + include_tasks: freepbx.yml + when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 25d5f0fc3..1f9450480 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -296,6 +296,14 @@ nodered_port: 1880 nextcloud_install: False nextcloud_enabled: False +# A full featured PBX based on Asterisk and FreePBX +# +# Caution! +# This is a LARGE install that will compile from source and take lots of time. Handle with care! +# So far, supported on Ubuntu 18.x ONLY. +pbx_install: False +pbx_enabled: False + # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: False wordpress_enabled: False diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index bbdeda7f3..dbde2211b 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -195,6 +195,14 @@ nodered_enabled: True nextcloud_install: True nextcloud_enabled: True +# A full featured PBX based on Asterisk and FreePBX +# +# Caution! +# This is a LARGE install that will compile from source and take lots of time. Handle with care! +# So far, supported on Ubuntu 18.x ONLY. +pbx_install: True +pbx_enabled: True + # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: True wordpress_enabled: True diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index 02bda6c19..eb4f5bd91 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -195,6 +195,14 @@ nodered_enabled: False nextcloud_install: True nextcloud_enabled: True +# A full featured PBX based on Asterisk and FreePBX +# +# Caution! +# This is a LARGE install that will compile from source and take lots of time. Handle with care! +# So far, supported on Ubuntu 18.x ONLY. +pbx_install: False +pbx_enabled: False + # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: True wordpress_enabled: True diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 908c2eb87..07c67f17c 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -195,6 +195,14 @@ nodered_enabled: False nextcloud_install: False nextcloud_enabled: False +# A full featured PBX based on Asterisk and FreePBX +# +# Caution! +# This is a LARGE install that will compile from source and take lots of time. Handle with care! +# So far, supported on Ubuntu 18.x ONLY. +pbx_install: False +pbx_enabled: False + # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: False wordpress_enabled: False From 571e2292b6276c30a6313af809e111fc4e469542 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 07:11:14 +0000 Subject: [PATCH 02/91] Fix chdir spacing in asterisk.yml --- roles/pbx/tasks/asterisk.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index b386226bb..e6091cb57 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -44,12 +44,12 @@ - name: Asterisk - Run the configure script command: "./configure" args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - Run make menuselect.makeopts command: "make menuselect.makeopts" args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - Do a bit of menuselect configuration command: > @@ -58,32 +58,32 @@ --enable EXTRA-SOUNDS-EN-WAV --enable EXTRA-SOUNDS-EN-G722 --enable EXTRA-SOUNDS-EN-GSM --disable-category MENUSELECT_MOH args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - Run 'make' command: make args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - install command: make install args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - install config command: make config args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - install samples command: make samples args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - ldconfig command: ldconfig args: - chdir:{{ asterisk_src_dir }} + chdir: {{ asterisk_src_dir }} - name: Asterisk - Create the necessary user/group config and set permissions command: "{{ item }} chdir={{ asterisk_src_dir }}" From 505226694782e14309b2138555fa0d4828d5d591 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 08:27:14 +0000 Subject: [PATCH 03/91] Asterisk: fix playbook syntax --- roles/pbx/tasks/asterisk.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index e6091cb57..1a7563dd0 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -33,23 +33,23 @@ - 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 + chdir: "{{ asterisk_src_dir }}" + creates: "addons/mp3/mpg123.h" - name: Asterisk - Ensure all dependencies are resolved shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - Run the configure script command: "./configure" args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - Run make menuselect.makeopts command: "make menuselect.makeopts" args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - Do a bit of menuselect configuration command: > @@ -58,32 +58,32 @@ --enable EXTRA-SOUNDS-EN-WAV --enable EXTRA-SOUNDS-EN-G722 --enable EXTRA-SOUNDS-EN-GSM --disable-category MENUSELECT_MOH args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - Run 'make' command: make args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - install command: make install args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - install config command: make config args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - install samples command: make samples args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - ldconfig command: ldconfig args: - chdir: {{ asterisk_src_dir }} + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - Create the necessary user/group config and set permissions command: "{{ item }} chdir={{ asterisk_src_dir }}" From b0e9d192b1611fe259528d5c0355976eb0f3dd54 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 08:34:29 +0000 Subject: [PATCH 04/91] Fix asterisk source tarball extraction --- roles/pbx/tasks/asterisk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 1a7563dd0..5ef38a630 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -29,6 +29,7 @@ dest: "{{ asterisk_src_dir }}" owner: root group: root + extra_opts: [--strip-components=1] - name: Asterisk - Download mp3 decoder library into source tree command: "./contrib/scripts/get_mp3_source.sh" From 6ab53213e0891905bbe20360025c11ae8f499f26 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 09:04:40 +0000 Subject: [PATCH 05/91] Asterisk - Installed aptitude. Fix chown command --- roles/pbx/tasks/asterisk.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 5ef38a630..bde06e557 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -37,6 +37,11 @@ chdir: "{{ asterisk_src_dir }}" creates: "addons/mp3/mpg123.h" +- name: Install aptitude (otherwise install_prereq fails) + package: + name: aptitude + state: latest + - name: Asterisk - Ensure all dependencies are resolved shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install args: @@ -93,7 +98,9 @@ - useradd -r -d /var/lib/asterisk -g asterisk asterisk - usermod -aG audio,dialout asterisk - chown -R asterisk.asterisk /etc/asterisk - - chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk + - chown -R asterisk.asterisk /var/lib/asterisk + - chown -R asterisk.asterisk /var/log/asterisk + - chown -R asterisk.asterisk /var/spool/asterisk - chown -R asterisk.asterisk /usr/lib/asterisk - name: Asterisk - Set default user to asterisk in /etc/default/asterisk From 25702f4e1d39965b54dec0e48bda18e8225e01d7 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 09:33:41 +0000 Subject: [PATCH 06/91] Asterisk - fix file ownership and group permissions --- roles/pbx/tasks/asterisk.yml | 39 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index bde06e557..129fbeb11 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -91,17 +91,32 @@ args: chdir: "{{ asterisk_src_dir }}" -- name: Asterisk - Create the necessary user/group config and set permissions - command: "{{ item }} 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 directory ownership + file: + dest: "{{ item }}" + owner: asterisk + group: asterisk + recurse: yes with_items: - - groupadd asterisk - - useradd -r -d /var/lib/asterisk -g asterisk asterisk - - usermod -aG audio,dialout asterisk - - chown -R asterisk.asterisk /etc/asterisk - - chown -R asterisk.asterisk /var/lib/asterisk - - chown -R asterisk.asterisk /var/log/asterisk - - chown -R asterisk.asterisk /var/spool/asterisk - - chown -R asterisk.asterisk /usr/lib/asterisk + - /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: @@ -133,7 +148,7 @@ name: asterisk enabled: yes state: started - when: asterisk_enabled + when: pbx_enabled - name: Disable & Stop asterisk service systemd: @@ -141,4 +156,4 @@ name: asterisk enabled: no state: stopped - when: (not asterisk_enabled) + when: (not pbx_enabled) From 490812e6a5c0882fda84eb2bcb33c878c17fa3d2 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 10:32:58 +0000 Subject: [PATCH 07/91] Initial stab at installing FreePBX --- roles/pbx/defaults/main.yml | 10 ++ roles/pbx/meta/main.yml | 3 + roles/pbx/tasks/asterisk.yml | 4 +- roles/pbx/tasks/asterisk_dependencies.yml | 2 +- roles/pbx/tasks/freepbx.yml | 142 ++++++++++++++++++++++ roles/pbx/tasks/freepbx_dependencies.yml | 29 +++++ roles/pbx/templates/freepbx.service.j2 | 12 ++ 7 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 roles/pbx/meta/main.yml create mode 100644 roles/pbx/tasks/freepbx_dependencies.yml create mode 100644 roles/pbx/templates/freepbx.service.j2 diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index 11db76841..c703d8503 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -5,3 +5,13 @@ 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 + +asterisk_db_host: localhost +asterisk_db_user: asterisk +asterisk_db_dbname: asterisk +asterisk_db_password: changeme +asterisk_db_cdrdbname: asteriskcdrdb + +freepbx_url: http://mirror.freepbx.org/modules/packages/freepbx/ +freepbx_src_file: freepbx-15.0-latest.tgz +freepbx_src_dir: /opt/iiab/freepbx diff --git a/roles/pbx/meta/main.yml b/roles/pbx/meta/main.yml new file mode 100644 index 000000000..239d8ab35 --- /dev/null +++ b/roles/pbx/meta/main.yml @@ -0,0 +1,3 @@ + dependencies: + - { role: nodejs, tags: ['nodejs'], when: pbx_install } + diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 129fbeb11..8fdee19ee 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -142,7 +142,7 @@ regexp: 'rungroup =' line: 'rungroup = asterisk' -- name: Enable & Start asterisk service +- name: Asterisk - Enable & Start asterisk service systemd: daemon_reload: yes name: asterisk @@ -150,7 +150,7 @@ state: started when: pbx_enabled -- name: Disable & Stop asterisk service +- name: Asterisk - Disable & Stop asterisk service systemd: daemon_reload: yes name: asterisk diff --git a/roles/pbx/tasks/asterisk_dependencies.yml b/roles/pbx/tasks/asterisk_dependencies.yml index 1191169eb..0738ddfe4 100644 --- a/roles/pbx/tasks/asterisk_dependencies.yml +++ b/roles/pbx/tasks/asterisk_dependencies.yml @@ -1,4 +1,4 @@ -- name: Install asterisk dependencies +- name: Asterisk - Install dependencies package: name: - git diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index e69de29bb..391873d63 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -0,0 +1,142 @@ +- 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 /opt/iiab/downloads/{{ freepbx_src_file }} + stat: + path: "{{ downloads_dir }}/{{ freepbx_src_file }}" + register: freepbx_src + +- name: FreePBX - FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ 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] + +- 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 }}" + 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 }}" + 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 - Disable & Stop asterisk service + systemd: + daemon_reload: yes + name: asterisk + enabled: no + state: stopped + +# using named groups due to this: http://www.handverdrahtet.org/2016/01/ansible-using-numbered-backreference.html +- name: FreePBX - Enable freepbx installation with remote mysql db + replace: + dest: "{{ freepbx_src_dir }}/installlib/installcommand.class.php" + regexp: "(?P\$amp_conf\[.AMPDBHOST.\] = .)localhost(.;)" + replace: "\g{{ asterisk_db_host }}\2" + +- name: 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: Install freepbx (just ran once) + command: "{{ item }}" + args: + chdir: "{{ freepbx_src_dir }}/freepbx" + creates: /var/www/freepbx + with_items: + - ./start_asterisk start + - ./install -n --webroot /var/www/freepbx --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }} + register: freepbx_installation + +- name: Install systemd freepbx service + copy: src=freepbx.service.j2 dest=/etc/systemd/system/freepbx.service mode=755 + +# http://community.freepbx.org/t/fixing-cdr-cel-on-ubuntu-debian-installation/30836 +# Test using `isql -v MySQL-asteriskcdrdb` +- name: Fix asterisk cdr odbc connection (1) + blockinfile: + dest: /etc/odbcinst.ini + create: yes + marker: "; {mark} ANSIBLE MANAGED BLOCK" + content: | + [MySQL] + Description = ODBC for MySQL + Driver = {{ libodbc_path }} + FileUsage = 1 + notify: Reload asterisk modules + +- name: Fix asterisk cdr odbc connection (2) + replace: + dest: /etc/odbc.ini + regexp: /var/lib/mysql/mysql.sock + replace: /var/run/mysqld/mysqld.sock + notify: Reload asterisk modules + +- name: Install freepbx modules + command: "fwconsole ma downloadinstall {{ item }}" + args: + creates: /var/www/freepbx/admin/modules/{{ item }} + with_items: + - userman + - asteriskinfo + - backup + - outroutemsg + +- name: FreePBX - Enable and start FreePBX service + systemd: + daemon_reload: yes + name: freepbx + enabled: yes + state: started + when: pbx_enabled + +- name: FreePBX - Disable and Stop FreePBX service + systemd: + daemon_reload: yes + name: freepbx + enabled: no + state: stopped + when: pbx_enabled diff --git a/roles/pbx/tasks/freepbx_dependencies.yml b/roles/pbx/tasks/freepbx_dependencies.yml new file mode 100644 index 000000000..381faf8f8 --- /dev/null +++ b/roles/pbx/tasks/freepbx_dependencies.yml @@ -0,0 +1,29 @@ +- name: FreePBX - Install dependencies + package: + name: + - wget + - git + - unixodbc # for asterisk cdr + - sudo # required by freepbx install script + - net-tools # fwconsole requirement + - cron # required by freepbx ucp package + - 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 + state: latest diff --git a/roles/pbx/templates/freepbx.service.j2 b/roles/pbx/templates/freepbx.service.j2 new file mode 100644 index 000000000..50a23eea8 --- /dev/null +++ b/roles/pbx/templates/freepbx.service.j2 @@ -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 From 1bd780eabe0a855bedd0a0e4dedbd53acc9eeca8 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 11:55:03 +0000 Subject: [PATCH 08/91] More FreePBX fixes --- roles/pbx/defaults/main.yml | 1 + roles/pbx/tasks/freepbx.yml | 31 +++++++++++++----------- roles/pbx/tasks/freepbx_dependencies.yml | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index c703d8503..3f098499b 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -15,3 +15,4 @@ asterisk_db_cdrdbname: asteriskcdrdb freepbx_url: http://mirror.freepbx.org/modules/packages/freepbx/ freepbx_src_file: freepbx-15.0-latest.tgz freepbx_src_dir: /opt/iiab/freepbx +libodbc_path: "" diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 391873d63..d81cd3eae 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -38,7 +38,7 @@ priv: "{{ asterisk_db_dbname }}.*:ALL/{{ asterisk_db_cdrdbname }}.*:ALL" login_host: "{{ asterisk_db_host }}" host: "{{ (asterisk_db_host == 'localhost') | ternary('localhost', ansible_default_ipv4.address) }}" - state: present + state: present - name: FreePBX - Add mysql db mysql_db: @@ -46,7 +46,7 @@ encoding: utf8 collation: utf8_general_ci login_host: "{{ asterisk_db_host }}" - state: present + state: present - name: FreePBX - Add cdr mysql db mysql_db: @@ -54,7 +54,7 @@ encoding: utf8 collation: utf8_general_ci login_host: "{{ asterisk_db_host }}" - state: present + state: present - name: FreePBX - Disable & Stop asterisk service systemd: @@ -63,12 +63,12 @@ enabled: no state: stopped -# using named groups due to this: http://www.handverdrahtet.org/2016/01/ansible-using-numbered-backreference.html -- name: FreePBX - Enable freepbx installation with remote mysql db - replace: - dest: "{{ freepbx_src_dir }}/installlib/installcommand.class.php" - regexp: "(?P\$amp_conf\[.AMPDBHOST.\] = .)localhost(.;)" - replace: "\g{{ asterisk_db_host }}\2" +## using named groups due to this: http://www.handverdrahtet.org/2016/01/ansible-using-numbered-backreference.html +#- name: Enable freepbx installation with remote mysql db +# replace: +# dest: '{{ freepbx_src_dir }}/installlib/installcommand.class.php' +# regexp: '(?P\$amp_conf\[.AMPDBHOST.\] = .)localhost(.;)' +# replace: '\g{{ asterisk_db_host }}\2' - name: Don't let freepbx take over the php sessions dir blockinfile: @@ -84,15 +84,20 @@ - name: Install freepbx (just ran once) command: "{{ item }}" args: - chdir: "{{ freepbx_src_dir }}/freepbx" + chdir: "{{ freepbx_src_dir }}" creates: /var/www/freepbx with_items: - ./start_asterisk start - ./install -n --webroot /var/www/freepbx --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }} register: freepbx_installation -- name: Install systemd freepbx service - copy: src=freepbx.service.j2 dest=/etc/systemd/system/freepbx.service mode=755 +- name: Install unit file /etc/systemd/system/freepbx.service from templates + template: + src: "freepbx.service.j2" + dest: "/etc/systemd/system/freepbx.service" + owner: root + group: root + mode: 0644 # http://community.freepbx.org/t/fixing-cdr-cel-on-ubuntu-debian-installation/30836 # Test using `isql -v MySQL-asteriskcdrdb` @@ -106,14 +111,12 @@ Description = ODBC for MySQL Driver = {{ libodbc_path }} FileUsage = 1 - notify: Reload asterisk modules - name: Fix asterisk cdr odbc connection (2) replace: dest: /etc/odbc.ini regexp: /var/lib/mysql/mysql.sock replace: /var/run/mysqld/mysqld.sock - notify: Reload asterisk modules - name: Install freepbx modules command: "fwconsole ma downloadinstall {{ item }}" diff --git a/roles/pbx/tasks/freepbx_dependencies.yml b/roles/pbx/tasks/freepbx_dependencies.yml index 381faf8f8..3e1b22ae0 100644 --- a/roles/pbx/tasks/freepbx_dependencies.yml +++ b/roles/pbx/tasks/freepbx_dependencies.yml @@ -26,4 +26,4 @@ - php-fpm - libapache2-mod-php - python-mysqldb # https://github.com/Yannik/ansible-role-freepbx/blob/master/tasks/freepbx.yml#L33 - state: latest + state: latest From 9f277653b1481f251675fa19f3575dffb33b9768 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 17 Jan 2019 12:16:08 +0000 Subject: [PATCH 09/91] Update FreePBX installation path --- roles/pbx/tasks/freepbx.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index d81cd3eae..d98da7fa0 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -85,10 +85,10 @@ command: "{{ item }}" args: chdir: "{{ freepbx_src_dir }}" - creates: /var/www/freepbx + creates: /var/www/html/freepbx with_items: - ./start_asterisk start - - ./install -n --webroot /var/www/freepbx --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }} + - ./install -n --webroot /var/www/html/freepbx --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }} register: freepbx_installation - name: Install unit file /etc/systemd/system/freepbx.service from templates @@ -121,7 +121,7 @@ - name: Install freepbx modules command: "fwconsole ma downloadinstall {{ item }}" args: - creates: /var/www/freepbx/admin/modules/{{ item }} + creates: /var/www/html/freepbx/admin/modules/{{ item }} with_items: - userman - asteriskinfo From c71063209119571eb34541f53e4ed91613db265e Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 07:12:34 +0000 Subject: [PATCH 10/91] Add checks to install pbx only when sugarizer is absent and nodejs version is correct --- roles/pbx/tasks/main.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 2ee162686..da4810761 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,9 +1,17 @@ +- name: Throw warning if sugarizer_install is true + debug: Refusing to install as sugarizer_install is true. Fix that and rerun. + when: pbx_install and sugarizer_install + +- name: Throw warning if sugarizer_install is true + debug: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. + when: pbx_install and (nodejs_version != "10.x") + #- name: TODO: Check if asterisk and freepbx are already installed - name: Install asterisk include_tasks: asterisk.yml - when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) + when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) and (not sugarizer_install) and (nodejs_version == "10.x") - name: Install freepbx include_tasks: freepbx.yml - when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) + when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) and (not sugarizer_install) and (nodejs_version == "10.x") From 85e03c1cacb11f189e5efcd25a970f1de4025ae3 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 07:13:40 +0000 Subject: [PATCH 11/91] comment out redundant variables from pbx/defaults/main.yml --- roles/pbx/defaults/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index 3f098499b..cdbfbdacd 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -6,11 +6,11 @@ asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/ asterisk_src_file: asterisk-16-current.tar.gz asterisk_src_dir: /opt/iiab/asterisk -asterisk_db_host: localhost -asterisk_db_user: asterisk -asterisk_db_dbname: asterisk -asterisk_db_password: changeme -asterisk_db_cdrdbname: asteriskcdrdb +#asterisk_db_host: localhost +#asterisk_db_user: asterisk +#asterisk_db_dbname: asterisk +#asterisk_db_password: changeme +#asterisk_db_cdrdbname: asteriskcdrdb freepbx_url: http://mirror.freepbx.org/modules/packages/freepbx/ freepbx_src_file: freepbx-15.0-latest.tgz From 01cfb3fc7b06331993b67fdc78d9972eb590e910 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 07:14:36 +0000 Subject: [PATCH 12/91] Add freepbx.conf apache file --- roles/pbx/templates/freepbx.conf.j2 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 roles/pbx/templates/freepbx.conf.j2 diff --git a/roles/pbx/templates/freepbx.conf.j2 b/roles/pbx/templates/freepbx.conf.j2 new file mode 100644 index 000000000..d4ef61dd3 --- /dev/null +++ b/roles/pbx/templates/freepbx.conf.j2 @@ -0,0 +1,19 @@ + + +ServerName pbx.lan + +ServerAdmin anishmg@umich.edu +DocumentRoot /var/www/html/ + + + Require all granted + + + +AssignUserId asterisk asterisk + + +ErrorLog ${APACHE_LOG_DIR}/pbx-error.log +CustomLog ${APACHE_LOG_DIR}/pbx-access.log combined + + From e66104a5e197544c94bcb58b8f9b257afbb0f4b8 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 07:25:34 +0000 Subject: [PATCH 13/91] Fix freepbx.yml playbook --- roles/pbx/tasks/freepbx.yml | 96 ++------------------------------- roles/pbx/templates/odbc.ini.j2 | 8 +++ 2 files changed, 12 insertions(+), 92 deletions(-) create mode 100644 roles/pbx/templates/odbc.ini.j2 diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index d98da7fa0..9abe5f7a6 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -31,31 +31,6 @@ group: root extra_opts: [--strip-components=1] -- 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 }}" - 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 }}" - 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 - Disable & Stop asterisk service systemd: daemon_reload: yes @@ -63,24 +38,6 @@ enabled: no state: stopped -## using named groups due to this: http://www.handverdrahtet.org/2016/01/ansible-using-numbered-backreference.html -#- name: Enable freepbx installation with remote mysql db -# replace: -# dest: '{{ freepbx_src_dir }}/installlib/installcommand.class.php' -# regexp: '(?P\$amp_conf\[.AMPDBHOST.\] = .)localhost(.;)' -# replace: '\g{{ asterisk_db_host }}\2' - -- name: 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: Install freepbx (just ran once) command: "{{ item }}" args: @@ -88,58 +45,13 @@ creates: /var/www/html/freepbx with_items: - ./start_asterisk start - - ./install -n --webroot /var/www/html/freepbx --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }} + - ./install -n --webroot /var/www/html/freepbx --dbuser root --dbpass {{ mysql_root_password }} register: freepbx_installation -- name: Install unit file /etc/systemd/system/freepbx.service from templates +- name: Create /etc/odbc.ini template: - src: "freepbx.service.j2" - dest: "/etc/systemd/system/freepbx.service" + src: odbc.ini.j2 + dest: /etc/odbc.ini owner: root group: root mode: 0644 - -# http://community.freepbx.org/t/fixing-cdr-cel-on-ubuntu-debian-installation/30836 -# Test using `isql -v MySQL-asteriskcdrdb` -- name: Fix asterisk cdr odbc connection (1) - blockinfile: - dest: /etc/odbcinst.ini - create: yes - marker: "; {mark} ANSIBLE MANAGED BLOCK" - content: | - [MySQL] - Description = ODBC for MySQL - Driver = {{ libodbc_path }} - FileUsage = 1 - -- name: Fix asterisk cdr odbc connection (2) - replace: - dest: /etc/odbc.ini - regexp: /var/lib/mysql/mysql.sock - replace: /var/run/mysqld/mysqld.sock - -- name: Install freepbx modules - command: "fwconsole ma downloadinstall {{ item }}" - args: - creates: /var/www/html/freepbx/admin/modules/{{ item }} - with_items: - - userman - - asteriskinfo - - backup - - outroutemsg - -- name: FreePBX - Enable and start FreePBX service - systemd: - daemon_reload: yes - name: freepbx - enabled: yes - state: started - when: pbx_enabled - -- name: FreePBX - Disable and Stop FreePBX service - systemd: - daemon_reload: yes - name: freepbx - enabled: no - state: stopped - when: pbx_enabled diff --git a/roles/pbx/templates/odbc.ini.j2 b/roles/pbx/templates/odbc.ini.j2 new file mode 100644 index 000000000..9ed77609a --- /dev/null +++ b/roles/pbx/templates/odbc.ini.j2 @@ -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 From 5b41e638e66c53dfa1b532da0595385e72d0c82c Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 07:59:49 +0000 Subject: [PATCH 14/91] Freepbx - Add libapache2-mpm-itk as a dependency --- roles/pbx/tasks/freepbx_dependencies.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/pbx/tasks/freepbx_dependencies.yml b/roles/pbx/tasks/freepbx_dependencies.yml index 3e1b22ae0..dee24dede 100644 --- a/roles/pbx/tasks/freepbx_dependencies.yml +++ b/roles/pbx/tasks/freepbx_dependencies.yml @@ -26,4 +26,5 @@ - 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 From d1be5a43c252dbf662719a14fca303e901a6ada6 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 08:00:20 +0000 Subject: [PATCH 15/91] Add freepbx_install_dir variable to defaults/main.yml --- roles/pbx/defaults/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index cdbfbdacd..1a2f5b8a3 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -15,4 +15,5 @@ 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 libodbc_path: "" From 4a544ab756c0455ced176933b9766aad41cd96fe Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 08:01:03 +0000 Subject: [PATCH 16/91] Stop enabling/disabling asterisk independently, as it will be handled by freepbx --- roles/pbx/tasks/asterisk.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 8fdee19ee..153264b0d 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -141,19 +141,3 @@ path: /etc/asterisk/asterisk.conf regexp: 'rungroup =' line: 'rungroup = asterisk' - -- name: Asterisk - Enable & Start asterisk service - systemd: - daemon_reload: yes - name: asterisk - enabled: yes - state: started - when: pbx_enabled - -- name: Asterisk - Disable & Stop asterisk service - systemd: - daemon_reload: yes - name: asterisk - enabled: no - state: stopped - when: (not pbx_enabled) From 759160cb754fb7dd02a921ca345e35dc98e49006 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 08:01:47 +0000 Subject: [PATCH 17/91] Use freepbx_install_dir variable in freepbx.conf.j2 apache2 template --- roles/pbx/templates/freepbx.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/pbx/templates/freepbx.conf.j2 b/roles/pbx/templates/freepbx.conf.j2 index d4ef61dd3..faafca223 100644 --- a/roles/pbx/templates/freepbx.conf.j2 +++ b/roles/pbx/templates/freepbx.conf.j2 @@ -2,10 +2,10 @@ ServerName pbx.lan -ServerAdmin anishmg@umich.edu +ServerAdmin admin@box.lan DocumentRoot /var/www/html/ - + Require all granted From 4bd9cc2364c779951070da37ebbdc8f4b79082f5 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 08:03:01 +0000 Subject: [PATCH 18/91] Freepbx task: Copy apache file; use freepbx_install_dir variable --- roles/pbx/tasks/freepbx.yml | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 9abe5f7a6..c2547050c 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -8,12 +8,12 @@ timeout: "{{ download_timeout }}" when: internet_available -- name: FreePBX - Check for /opt/iiab/downloads/{{ freepbx_src_file }} +- 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 /opt/iiab/downloads/{{ freepbx_src_file }} doesn't exist +- 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 @@ -38,20 +38,41 @@ enabled: no state: stopped -- name: Install freepbx (just ran once) +- name: FreePBX - Install (just run once) command: "{{ item }}" args: chdir: "{{ freepbx_src_dir }}" - creates: /var/www/html/freepbx + creates: "{{ freepbx_install_dir }}" with_items: - ./start_asterisk start - - ./install -n --webroot /var/www/html/freepbx --dbuser root --dbpass {{ mysql_root_password }} + - ./install -n --webroot {{ freepbx_install_dir }} --dbuser root --dbpass {{ mysql_root_password }} register: freepbx_installation -- name: Create /etc/odbc.ini +- 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 - Enable freepbx + file: + src: /etc/apache2/sites-available/freepbx.conf + dest: /etc/apache2/sites-enabled/freepbx.conf + state: link + when: pbx_enabled + +- name: FreePBX - Disable freepbx + file: + path: /etc/apache2/sites-enabled/freepbx.conf + state: absent + when: (not pbx_enabled) From 2f8b08dc3310bd8efb880d85755d2a53944f3725 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 08:09:29 +0000 Subject: [PATCH 19/91] Fix indentation in asterisk.yml playbook --- roles/pbx/tasks/asterisk.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 153264b0d..61cb27b6d 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -120,24 +120,24 @@ - name: Asterisk - Set default user to asterisk in /etc/default/asterisk lineinfile: - path: /etc/default/asterisk - regexp: 'AST_USER=' - line: 'AST_USER="asterisk"' + 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"' + 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' + 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' + path: /etc/asterisk/asterisk.conf + regexp: 'rungroup =' + line: 'rungroup = asterisk' From e884066a85fa901a6abd623e95b619f75bc2e9be Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 08:48:42 +0000 Subject: [PATCH 20/91] Fix debug syntax in pbx/tasks/main.yml --- roles/pbx/tasks/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index da4810761..0c3823d7e 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,9 +1,11 @@ - name: Throw warning if sugarizer_install is true - debug: Refusing to install as sugarizer_install is true. Fix that and rerun. + debug: + msg: Refusing to install as sugarizer_install is true. Fix that and rerun. when: pbx_install and sugarizer_install - name: Throw warning if sugarizer_install is true - debug: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. + debug: + msg: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. when: pbx_install and (nodejs_version != "10.x") #- name: TODO: Check if asterisk and freepbx are already installed From e7a0f900b3bfa808482706bb193889c914925435 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 09:15:37 +0000 Subject: [PATCH 21/91] Create freepbx systemd service --- roles/pbx/tasks/freepbx.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index c2547050c..a8e3775a3 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -64,15 +64,37 @@ group: www-data mode: 0644 -- name: FreePBX - Enable freepbx +- 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 - Disable freepbx +- 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) From 235284a22823010f33841fea3ed0cacabb01605b Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 09:32:42 +0000 Subject: [PATCH 22/91] Add commented out nodejs_version variable near the pbx flags in vars --- vars/default_vars.yml | 1 + vars/local_vars_big.yml | 1 + vars/local_vars_medium.yml | 1 + vars/local_vars_min.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 1f9450480..bd42777ab 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -303,6 +303,7 @@ nextcloud_enabled: False # So far, supported on Ubuntu 18.x ONLY. pbx_install: False pbx_enabled: False +#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: False diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index dbde2211b..18c4b75a4 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -202,6 +202,7 @@ nextcloud_enabled: True # So far, supported on Ubuntu 18.x ONLY. pbx_install: True pbx_enabled: True +#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: True diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index eb4f5bd91..c3666273b 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -202,6 +202,7 @@ nextcloud_enabled: True # So far, supported on Ubuntu 18.x ONLY. pbx_install: False pbx_enabled: False +#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: True diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 07c67f17c..6b2cf55d6 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -202,6 +202,7 @@ nextcloud_enabled: False # So far, supported on Ubuntu 18.x ONLY. pbx_install: False pbx_enabled: False +#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: False From 65a3b020e3daacd6a0af1513589222046b1a0ac6 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 10:07:29 +0000 Subject: [PATCH 23/91] PBX: Dont install nodejs if incorrect version is chosen --- roles/pbx/meta/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/meta/main.yml b/roles/pbx/meta/main.yml index 239d8ab35..30cca5358 100644 --- a/roles/pbx/meta/main.yml +++ b/roles/pbx/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - - { role: nodejs, tags: ['nodejs'], when: pbx_install } + - { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x")} From 5ccf7f33d0dac7bf1364fd45536a83b0dc56006d Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 10:08:37 +0000 Subject: [PATCH 24/91] PBX: fix debug messages --- roles/pbx/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 0c3823d7e..d197f70a0 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -3,7 +3,7 @@ msg: Refusing to install as sugarizer_install is true. Fix that and rerun. when: pbx_install and sugarizer_install -- name: Throw warning if sugarizer_install is true +- name: Throw warning if nodejs_version is incorrect debug: msg: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. when: pbx_install and (nodejs_version != "10.x") From 61f63e55da4d4e339af6711028e7ede1807dbf55 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 10:12:10 +0000 Subject: [PATCH 25/91] Fix nodejs installation condition in pbx --- roles/pbx/meta/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/meta/main.yml b/roles/pbx/meta/main.yml index 30cca5358..dc910f6d6 100644 --- a/roles/pbx/meta/main.yml +++ b/roles/pbx/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - - { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x")} + - { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x") and (not sugarizer_install)} From 8b219b65d0fd8d048ecc031510ce53832cbe8380 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 11:10:48 +0000 Subject: [PATCH 26/91] Remove unneeded register commands in freepbx.yml playbook --- roles/pbx/tasks/freepbx.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index a8e3775a3..bf60e39a0 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -11,7 +11,6 @@ - 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: @@ -46,7 +45,6 @@ with_items: - ./start_asterisk start - ./install -n --webroot {{ freepbx_install_dir }} --dbuser root --dbpass {{ mysql_root_password }} - register: freepbx_installation - name: FreePBX - Create /etc/odbc.ini template: From 72866c76aadeeb8abbcec497bff1caa2e69958c4 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 16:53:42 +0000 Subject: [PATCH 27/91] asterisk.yml, optimze --- roles/pbx/tasks/asterisk.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 61cb27b6d..1cb89ddfa 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -30,6 +30,7 @@ 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" @@ -50,12 +51,14 @@ - name: Asterisk - Run the configure script command: "./configure" args: - chdir: "{{ asterisk_src_dir }}" + chdir: "{{ asterisk_src_dir }}" + creates: "config.log" - 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: > @@ -70,21 +73,13 @@ command: make args: chdir: "{{ asterisk_src_dir }}" + creates: "defaults.h" - name: Asterisk - install command: make install args: chdir: "{{ asterisk_src_dir }}" - -- name: Asterisk - install config - command: make config - args: - chdir: "{{ asterisk_src_dir }}" - -- name: Asterisk - install samples - command: make samples - args: - chdir: "{{ asterisk_src_dir }}" + creates: "/usr/sbin/asterisk" - name: Asterisk - ldconfig command: ldconfig From 6f313397e159e0302c392cee067db3c9c3ce4a8e Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 18 Jan 2019 16:56:58 +0000 Subject: [PATCH 28/91] pbx/defaults/main.yml: remove deprecated code --- roles/pbx/defaults/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index 1a2f5b8a3..265d7fafb 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -6,12 +6,6 @@ asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/ asterisk_src_file: asterisk-16-current.tar.gz asterisk_src_dir: /opt/iiab/asterisk -#asterisk_db_host: localhost -#asterisk_db_user: asterisk -#asterisk_db_dbname: asterisk -#asterisk_db_password: changeme -#asterisk_db_cdrdbname: asteriskcdrdb - freepbx_url: http://mirror.freepbx.org/modules/packages/freepbx/ freepbx_src_file: freepbx-15.0-latest.tgz freepbx_src_dir: /opt/iiab/freepbx From 8dbc4fe469557a3725420aadd32f10674b8f8395 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 04:38:47 +0000 Subject: [PATCH 29/91] freepbx.yml optimize --- roles/pbx/tasks/freepbx.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index bf60e39a0..37d9582de 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -29,6 +29,7 @@ owner: root group: root extra_opts: [--strip-components=1] + creates: "{{ freepbx_src_dir }}/install" - name: FreePBX - Disable & Stop asterisk service systemd: From ed5a6838e3bf439fcb464c370da1945ea8f4021e Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 04:50:38 +0000 Subject: [PATCH 30/91] Add a README to PBX role --- roles/pbx/README.rst | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 roles/pbx/README.rst diff --git a/roles/pbx/README.rst b/roles/pbx/README.rst new file mode 100644 index 000000000..06b3ff971 --- /dev/null +++ b/roles/pbx/README.rst @@ -0,0 +1,40 @@ +=============== +PBX README +=============== + +Adds `Asterisk `_ and `FreePBX `_ 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 `_ contains:: + + pbx_install: True + pbx_enabled: True + nodejs_version: 10.x + +As a dependency the following must be set:: + + sugarizer_install: False + sugarizer_enabled: False + + +After installing PBX as part IIAB, please log in to http://pbx.lan and proceed with inital configuration. + +You can monitor the PBX service with command:: + + systemctl status freepbx + +Attribution +----------- + +The asterisk and freepbx playbooks have been heavily inspired by the work `here `_ and `here `_. +Dependencies +------------ + +1. This playbooks compiles and installs asterisk and freepbx from source, so running this feature involves significant bandwidth and compute time. +2. This playbook is also incompatible with sugarizer, and nodejs-8.x. Therefore if either of those are set to be install, this playbook will gracefully fail with a message requesting the user to fix those incompatibilites. From 4dcad923983be632a6da3b44237aab5ce10dc4fa Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 05:06:17 +0000 Subject: [PATCH 31/91] pbx/defaults/main.yml: Add chan_dongle variables, remove unneeded libodbc_path --- roles/pbx/defaults/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index 265d7fafb..8e771340e 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -10,4 +10,7 @@ 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 -libodbc_path: "" + +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 From 5e687559ad669a78f30f5fce97e492eaa5ac83c0 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 05:12:48 +0000 Subject: [PATCH 32/91] Add chan_dongle.yml --- roles/pbx/tasks/chan_dongle.yml | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 roles/pbx/tasks/chan_dongle.yml diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml new file mode 100644 index 000000000..b41dd50ad --- /dev/null +++ b/roles/pbx/tasks/chan_dongle.yml @@ -0,0 +1,45 @@ +- 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: "{{ chan_dongle_src_dir }}" + owner: root + group: root + extra_opts: [--strip-components=1] + creates: "{{ chan_dongle_src_dir }}/Makefile.in" + +- name: chan_dongle - Run the bootstrap script + command: "./bootstrap" + args: + chdir: "{{ chan_dongle_src_dir }}" + +- name: chan_dongle - Run the configure script + command: "./configure" + args: + chdir: "{{ chan_dongle_src_dir }}" + +- name: chan_dongle - Run 'make' + command: make + args: + chdir: "{{ chan_dongle_src_dir }}" From 2a30b22206b7cb99893882876ce001ec96bd41a0 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 05:16:31 +0000 Subject: [PATCH 33/91] Include chan_dongle.yml in asterisk.yml --- roles/pbx/tasks/asterisk.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 1cb89ddfa..cd9fd552c 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -136,3 +136,7 @@ path: /etc/asterisk/asterisk.conf regexp: 'rungroup =' line: 'rungroup = asterisk' + +- name: Asterisk - Install chan_dongle + include: chan_dongle.yml + when: asterisk_chan_dongle From 983efe5f6b24e11b9ae1af826cf605fedf458fe8 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 05:20:48 +0000 Subject: [PATCH 34/91] PBX: Update README.rst with chan_dongle information --- roles/pbx/README.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/pbx/README.rst b/roles/pbx/README.rst index 06b3ff971..e1b506e6a 100644 --- a/roles/pbx/README.rst +++ b/roles/pbx/README.rst @@ -17,12 +17,15 @@ Prior to installing IIAB, make sure your `/etc/iiab/local_vars.yml `_, 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 + +As a dependency the following *must* be set:: sugarizer_install: False sugarizer_enabled: False - After installing PBX as part IIAB, please log in to http://pbx.lan and proceed with inital configuration. You can monitor the PBX service with command:: From a8fa325447c33fe420f71cacc28c83ca57d5f668 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 05:22:33 +0000 Subject: [PATCH 35/91] Add asterisk_chan_dongle flag to conditionally allow its install --- roles/pbx/defaults/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index 8e771340e..f546fda2c 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -1,6 +1,7 @@ pbx_install: False pbx_enabled: False pbx_installed: False +asterisk_chan_dongle: False asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/ asterisk_src_file: asterisk-16-current.tar.gz From e7d842ab90c8ed175e1264cf07f75bd369d015d2 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 05:40:51 +0000 Subject: [PATCH 36/91] Fix and optimize chan_dongle.yml --- roles/pbx/tasks/chan_dongle.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index b41dd50ad..5d8679c59 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -33,13 +33,26 @@ command: "./bootstrap" args: chdir: "{{ chan_dongle_src_dir }}" + creates: "{{ chan_dongle_src_dir }}/configure" + +- name: chan_dongle - Find out asterisk version + command: "asterisk -V |cut -d ' ' -f 2" + register: asterisk_ver - name: chan_dongle - Run the configure script - command: "./configure" + 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" From 34c0c0551ef47c406a50fc1f1b16216eb54cb93c Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 07:47:10 +0000 Subject: [PATCH 37/91] Add asterisk_chan_dongle flag to vars --- vars/default_vars.yml | 1 + vars/local_vars_big.yml | 1 + vars/local_vars_medium.yml | 1 + vars/local_vars_min.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index bd42777ab..6b91d4c29 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -303,6 +303,7 @@ nextcloud_enabled: False # So far, supported on Ubuntu 18.x ONLY. pbx_install: False pbx_enabled: False +asterisk_chan_dongle: False #nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 18c4b75a4..10b9a94e7 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -202,6 +202,7 @@ nextcloud_enabled: True # So far, supported on Ubuntu 18.x ONLY. pbx_install: True pbx_enabled: True +asterisk_chan_dongle: True #nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index c3666273b..98abc7904 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -202,6 +202,7 @@ nextcloud_enabled: True # So far, supported on Ubuntu 18.x ONLY. pbx_install: False pbx_enabled: False +asterisk_chan_dongle: False #nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 6b2cf55d6..f61650832 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -202,6 +202,7 @@ nextcloud_enabled: False # So far, supported on Ubuntu 18.x ONLY. pbx_install: False pbx_enabled: False +asterisk_chan_dongle: False #nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER From 31e5a795d95456361bf00eb5a448d632f4d4d730 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 08:12:15 +0000 Subject: [PATCH 38/91] Add make samples to asterisk.yml --- roles/pbx/tasks/asterisk.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index cd9fd552c..500653aab 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -81,6 +81,12 @@ chdir: "{{ asterisk_src_dir }}" creates: "/usr/sbin/asterisk" +- name: Asterisk - sample config + command: make samples + args: + chdir: "{{ asterisk_src_dir }}" + creates: "/etc/default/asterisk" + - name: Asterisk - ldconfig command: ldconfig args: From 8b7da40c8384a0108322a561b7b32157d334eebc Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 13:37:24 +0000 Subject: [PATCH 39/91] Add make basic-pbx to asterisk.yml --- roles/pbx/tasks/asterisk.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 500653aab..4814dbd6c 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -85,7 +85,11 @@ command: make samples args: chdir: "{{ asterisk_src_dir }}" - creates: "/etc/default/asterisk" + +- name: Asterisk - basic pbx + command: make basic-pbx + args: + chdir: "{{ asterisk_src_dir }}" - name: Asterisk - ldconfig command: ldconfig From 03540d19a9e83584e311a043e8b2a90338bac9cb Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 13:47:57 +0000 Subject: [PATCH 40/91] Fix asterisk.yml playbook --- roles/pbx/tasks/asterisk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 4814dbd6c..1f8215824 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -92,7 +92,7 @@ chdir: "{{ asterisk_src_dir }}" - name: Asterisk - ldconfig - command: ldconfig + shell: ldconfig args: chdir: "{{ asterisk_src_dir }}" From 1f254f8caa6ee0d93cbac5763dc64e9d2b9b9f97 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 14:10:16 +0000 Subject: [PATCH 41/91] fix chan_dongle.yml playbook - unzip command --- roles/pbx/tasks/chan_dongle.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index 5d8679c59..2acfbf8a7 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -23,11 +23,14 @@ - name: chan_dongle - Extract source unarchive: src: "{{ downloads_dir }}/{{ chan_dongle_src_file }}" - dest: "{{ chan_dongle_src_dir }}" + dest: "{{ downloads_dir }}" owner: root group: root - extra_opts: [--strip-components=1] - creates: "{{ chan_dongle_src_dir }}/Makefile.in" + +- name: chan_dongle - move to {{ chan_dongle_src_dir }} + command: mv {{ downloads_dir }}/chan_dongle* {{ chan_dongle_src_dir }} + args: + chdir: "{{ chan_dongle_src_dir }}" - name: chan_dongle - Run the bootstrap script command: "./bootstrap" From 3e5aae4118add15f442f3da039abb7f3556e44c2 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 14:12:44 +0000 Subject: [PATCH 42/91] Fix chan_dongle.yml again --- roles/pbx/tasks/chan_dongle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index 2acfbf8a7..433dd70f5 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -28,9 +28,9 @@ group: root - name: chan_dongle - move to {{ chan_dongle_src_dir }} - command: mv {{ downloads_dir }}/chan_dongle* {{ chan_dongle_src_dir }} + command: mv {{ downloads_dir }}/asterisk-chan-dongle* {{ chan_dongle_src_dir }} args: - chdir: "{{ chan_dongle_src_dir }}" + chdir: "{{ downloads_dir }}" - name: chan_dongle - Run the bootstrap script command: "./bootstrap" From 2e9dcb268f9ddea807ff17c2f3efa2e024e736e7 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 14:17:23 +0000 Subject: [PATCH 43/91] chan_dongle fix mv src path --- roles/pbx/tasks/chan_dongle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index 433dd70f5..7e2437910 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -28,7 +28,7 @@ group: root - name: chan_dongle - move to {{ chan_dongle_src_dir }} - command: mv {{ downloads_dir }}/asterisk-chan-dongle* {{ chan_dongle_src_dir }} + command: mv {{ downloads_dir }}/asterisk-chan-dongle-master {{ chan_dongle_src_dir }} args: chdir: "{{ downloads_dir }}" From 92529b83878ad0efb93c9899139fd8442260bd8e Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 14:22:38 +0000 Subject: [PATCH 44/91] chan_dongle fix dest path in mv --- roles/pbx/tasks/chan_dongle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index 7e2437910..b62971ecc 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -28,7 +28,7 @@ group: root - name: chan_dongle - move to {{ chan_dongle_src_dir }} - command: mv {{ downloads_dir }}/asterisk-chan-dongle-master {{ chan_dongle_src_dir }} + command: mv {{ downloads_dir }}/asterisk-chan-dongle-master/ {{ chan_dongle_src_dir }} args: chdir: "{{ downloads_dir }}" From b21251d4fb26b00cec5c162b56bf0b02d64b4660 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 14:28:20 +0000 Subject: [PATCH 45/91] chandongle use rsync instead of mv --- roles/pbx/tasks/chan_dongle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index b62971ecc..476ee7447 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -28,7 +28,7 @@ group: root - name: chan_dongle - move to {{ chan_dongle_src_dir }} - command: mv {{ downloads_dir }}/asterisk-chan-dongle-master/ {{ chan_dongle_src_dir }} + command: rsync -av {{ downloads_dir }}/asterisk-chan-dongle-master/ {{ chan_dongle_src_dir }} args: chdir: "{{ downloads_dir }}" From 2693605be2b558e2923f735dc6d86c9481068a0f Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 14:36:25 +0000 Subject: [PATCH 46/91] chan_dongle properly extract asterisk version --- roles/pbx/tasks/chan_dongle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index 476ee7447..271de13c0 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -39,7 +39,7 @@ creates: "{{ chan_dongle_src_dir }}/configure" - name: chan_dongle - Find out asterisk version - command: "asterisk -V |cut -d ' ' -f 2" + shell: asterisk -V |cut -d " " -f 2 register: asterisk_ver - name: chan_dongle - Run the configure script From 2b443ce40425f040bbb8bc7ee29790ada2012361 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 14:43:04 +0000 Subject: [PATCH 47/91] fix missing freepbx_src --- roles/pbx/tasks/freepbx.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 37d9582de..88dba6231 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -11,6 +11,7 @@ - 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: From c31046b46a77205e17a86e3d90c432183f03ec16 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 15:14:39 +0000 Subject: [PATCH 48/91] remove make basic-pbx from asterisk.yml as it messes up /etc/asterisk/asterisk.conf --- roles/pbx/tasks/asterisk.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 1f8215824..5f01724a5 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -86,11 +86,6 @@ args: chdir: "{{ asterisk_src_dir }}" -- name: Asterisk - basic pbx - command: make basic-pbx - args: - chdir: "{{ asterisk_src_dir }}" - - name: Asterisk - ldconfig shell: ldconfig args: From 34759820417e923fa6302874d885243d3718f088 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 15:34:54 +0000 Subject: [PATCH 49/91] PBX Fail if proper nodejs version is not set --- roles/pbx/meta/main.yml | 2 +- roles/pbx/tasks/main.yml | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/roles/pbx/meta/main.yml b/roles/pbx/meta/main.yml index dc910f6d6..30cca5358 100644 --- a/roles/pbx/meta/main.yml +++ b/roles/pbx/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - - { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x") and (not sugarizer_install)} + - { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x")} diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index d197f70a0..57c2ececd 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,11 +1,6 @@ -- name: Throw warning if sugarizer_install is true - debug: - msg: Refusing to install as sugarizer_install is true. Fix that and rerun. - when: pbx_install and sugarizer_install - - name: Throw warning if nodejs_version is incorrect - debug: - msg: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. + fail: + msg: PBX: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. when: pbx_install and (nodejs_version != "10.x") #- name: TODO: Check if asterisk and freepbx are already installed From 75e4f7819805899bf0c14dc3b081fa85fb1a516b Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 15:44:59 +0000 Subject: [PATCH 50/91] Fix message in pbx/tasks/main.yml --- roles/pbx/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 57c2ececd..f94497c0b 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,4 +1,4 @@ -- name: Throw warning if nodejs_version is incorrect +- name: Fail if nodejs_version is incorrect fail: msg: PBX: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. when: pbx_install and (nodejs_version != "10.x") From e44bdc7fc3d46354dba13cf270a638fdbeb3554f Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 16:10:08 +0000 Subject: [PATCH 51/91] Make freepbx.conf apache2 file more secure --- roles/pbx/templates/freepbx.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/pbx/templates/freepbx.conf.j2 b/roles/pbx/templates/freepbx.conf.j2 index faafca223..87cc876d6 100644 --- a/roles/pbx/templates/freepbx.conf.j2 +++ b/roles/pbx/templates/freepbx.conf.j2 @@ -6,6 +6,8 @@ ServerAdmin admin@box.lan DocumentRoot /var/www/html/ + AllowOverride All + Options Indexes FollowSymLinks Require all granted From 8367b6c6bbfeab02f9b04854e1a9083d4e4126fc Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sat, 19 Jan 2019 16:32:42 +0000 Subject: [PATCH 52/91] chan_dongle, copy dongle.conf over --- roles/pbx/tasks/chan_dongle.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/pbx/tasks/chan_dongle.yml b/roles/pbx/tasks/chan_dongle.yml index 271de13c0..5cef9861f 100644 --- a/roles/pbx/tasks/chan_dongle.yml +++ b/roles/pbx/tasks/chan_dongle.yml @@ -59,3 +59,10 @@ 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" + From 9b19f57ca2ff3c3b0b2fd60373336d402d414b45 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sun, 20 Jan 2019 03:49:33 +0000 Subject: [PATCH 53/91] Fix syntax in debug msg, pbx/tasks/main.yml --- roles/pbx/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index f94497c0b..21721e779 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,6 +1,6 @@ - name: Fail if nodejs_version is incorrect fail: - msg: PBX: Refusing to install as nodejs_version is not 10.x. Fix that and rerun. + msg: "PBX: Refusing to install as nodejs_version is not 10.x. Fix that and rerun." when: pbx_install and (nodejs_version != "10.x") #- name: TODO: Check if asterisk and freepbx are already installed From 379dd8d1015719ec28fec4fd0cff5af4dfaf8b8a Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sun, 20 Jan 2019 05:41:28 +0000 Subject: [PATCH 54/91] Freepbx: Explicitly set asterisk db credentials --- roles/pbx/defaults/main.yml | 6 ++++++ roles/pbx/tasks/freepbx.yml | 27 ++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index f546fda2c..cdbaeec6e 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -12,6 +12,12 @@ 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 diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 88dba6231..2039f01c3 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -39,6 +39,31 @@ enabled: no state: stopped +- name: 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 }}" + host: "{{ (asterisk_db_host == 'localhost') | ternary('localhost', ansible_default_ipv4.address) }}" + state: present + +- name: Add mysql db + mysql_db: + name: "{{ asterisk_db_dbname }}" + encoding: utf8 + collation: utf8_general_ci + login_host: "{{ asterisk_db_host }}" + state: present + +- name: 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 - Install (just run once) command: "{{ item }}" args: @@ -46,7 +71,7 @@ creates: "{{ freepbx_install_dir }}" with_items: - ./start_asterisk start - - ./install -n --webroot {{ freepbx_install_dir }} --dbuser root --dbpass {{ mysql_root_password }} + - ./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: From aa8f6424b90b83e78543a3eeb937a6984404a203 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sun, 20 Jan 2019 06:22:12 +0000 Subject: [PATCH 55/91] Add make config to asterisk.yml --- roles/pbx/tasks/asterisk.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index 5f01724a5..f6b2a8b91 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -81,7 +81,12 @@ chdir: "{{ asterisk_src_dir }}" creates: "/usr/sbin/asterisk" -- name: Asterisk - sample config +- name: Asterisk - config + command: make config + args: + chdir: "{{ asterisk_src_dir }}" + +- name: Asterisk - samples command: make samples args: chdir: "{{ asterisk_src_dir }}" From 1f3c88623bd67870644e56ab3ed64e6fb18b4f21 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sun, 20 Jan 2019 08:09:52 +0000 Subject: [PATCH 56/91] Dont let freepbx take over sessions directory --- roles/pbx/tasks/freepbx.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 2039f01c3..6dcff54b8 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -39,7 +39,7 @@ enabled: no state: stopped -- name: Add mysql user +- name: FreePBX - Add mysql user mysql_user: name: "{{ asterisk_db_user }}" password: "{{ asterisk_db_password }}" @@ -48,7 +48,7 @@ host: "{{ (asterisk_db_host == 'localhost') | ternary('localhost', ansible_default_ipv4.address) }}" state: present -- name: Add mysql db +- name: FreePBX - Add mysql db mysql_db: name: "{{ asterisk_db_dbname }}" encoding: utf8 @@ -56,7 +56,7 @@ login_host: "{{ asterisk_db_host }}" state: present -- name: Add cdr mysql db +- name: FreePBX - Add cdr mysql db mysql_db: name: "{{ asterisk_db_cdrdbname }}" encoding: utf8 @@ -64,6 +64,17 @@ 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 - Install (just run once) command: "{{ item }}" args: From 7713b6da188316691bc92989ecc577d6a9f6dda6 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sun, 20 Jan 2019 08:30:21 +0000 Subject: [PATCH 57/91] Authenticate db creation with mysql root user --- roles/pbx/tasks/freepbx.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 6dcff54b8..f0aab34fc 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -45,6 +45,8 @@ 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 @@ -54,6 +56,8 @@ 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 From 80005344e7c8f999d78b8a1594d52ce89e6db017 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sun, 20 Jan 2019 12:45:22 +0000 Subject: [PATCH 58/91] Run FreePBX php sessions in their own directory, to circumvent ownership problems --- roles/pbx/tasks/freepbx.yml | 12 ++++++++++++ roles/pbx/templates/freepbx.conf.j2 | 2 ++ 2 files changed, 14 insertions(+) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index f0aab34fc..7af404b41 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -79,6 +79,18 @@ 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) command: "{{ item }}" args: diff --git a/roles/pbx/templates/freepbx.conf.j2 b/roles/pbx/templates/freepbx.conf.j2 index 87cc876d6..1a8cabd0d 100644 --- a/roles/pbx/templates/freepbx.conf.j2 +++ b/roles/pbx/templates/freepbx.conf.j2 @@ -15,6 +15,8 @@ DocumentRoot /var/www/html/ AssignUserId asterisk asterisk +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 From d9f76f7ea5427163776d805effa2f18b1d2a4c28 Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Sun, 20 Jan 2019 12:48:45 +0000 Subject: [PATCH 59/91] Do not install freepbx by default in BIG install --- vars/local_vars_big.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 10b9a94e7..c1b3ca138 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -200,9 +200,9 @@ nextcloud_enabled: True # Caution! # This is a LARGE install that will compile from source and take lots of time. Handle with care! # So far, supported on Ubuntu 18.x ONLY. -pbx_install: True -pbx_enabled: True -asterisk_chan_dongle: True +pbx_install: False +pbx_enabled: False +asterisk_chan_dongle: False #nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER From 425df6b4f03c2de749638107c501e7522162cc6b Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Fri, 25 Jan 2019 22:16:30 +0530 Subject: [PATCH 60/91] Add pbx and pbx.lan to /etc/hosts --- roles/network/tasks/hosts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/hosts.yml b/roles/network/tasks/hosts.yml index 4e0e2d026..601834223 100644 --- a/roles/network/tasks/hosts.yml +++ b/roles/network/tasks/hosts.yml @@ -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 From 7b25c9958a1dc7e47dd41d31d56bfe43359207ef Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 7 Feb 2019 14:11:19 +0000 Subject: [PATCH 61/91] Add support for debian 9.7 --- roles/pbx/tasks/asterisk.yml | 3 +-- roles/pbx/tasks/main.yml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index f6b2a8b91..d10b0ec7d 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -49,10 +49,9 @@ chdir: "{{ asterisk_src_dir }}" - name: Asterisk - Run the configure script - command: "./configure" + command: "./configure --with-jansson-bundled" args: chdir: "{{ asterisk_src_dir }}" - creates: "config.log" - name: Asterisk - Run make menuselect.makeopts command: "make menuselect.makeopts" diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 21721e779..2afa5025e 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -7,8 +7,8 @@ - name: Install asterisk include_tasks: asterisk.yml - when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) and (not sugarizer_install) and (nodejs_version == "10.x") + when: internet_available and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18) and pbx_install and (not pbx_installed) and (nodejs_version == "10.x") - name: Install freepbx include_tasks: freepbx.yml - when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) and (not sugarizer_install) and (nodejs_version == "10.x") + when: internet_available and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18) and pbx_install and (not pbx_installed) and (nodejs_version == "10.x") From 5460e059aebc75408098d544e62020c12d2337df Mon Sep 17 00:00:00 2001 From: Anish Mangal Date: Thu, 7 Feb 2019 14:12:10 +0000 Subject: [PATCH 62/91] PBX: Update README.rst --- roles/pbx/README.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/roles/pbx/README.rst b/roles/pbx/README.rst index e1b506e6a..69e95cbaf 100644 --- a/roles/pbx/README.rst +++ b/roles/pbx/README.rst @@ -15,17 +15,11 @@ Prior to installing IIAB, make sure your `/etc/iiab/local_vars.yml `_, 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 -As a dependency the following *must* be set:: - - sugarizer_install: False - sugarizer_enabled: False - After installing PBX as part IIAB, please log in to http://pbx.lan and proceed with inital configuration. You can monitor the PBX service with command:: @@ -40,4 +34,3 @@ Dependencies ------------ 1. This playbooks compiles and installs asterisk and freepbx from source, so running this feature involves significant bandwidth and compute time. -2. This playbook is also incompatible with sugarizer, and nodejs-8.x. Therefore if either of those are set to be install, this playbook will gracefully fail with a message requesting the user to fix those incompatibilites. From ed76faec77d81cd1b0a01a1924802126d850df5b Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 08:59:12 -0500 Subject: [PATCH 63/91] Create README.rst --- roles/network/README.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 roles/network/README.rst diff --git a/roles/network/README.rst b/roles/network/README.rst new file mode 100644 index 000000000..e1969f4f8 --- /dev/null +++ b/roles/network/README.rst @@ -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' stage 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' 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``) + +For more info, please see: + +- https://github.com/iiab/iiab/wiki/IIAB-Networking +- http://FAQ.IIAB.IO including 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? From 06d696da9f594677b90f1af6ac34cec46c7011ac Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 09:31:10 -0500 Subject: [PATCH 64/91] Update main.yml --- roles/0-init/tasks/main.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index 06a1fc744..acdbc4c27 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -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 From f31955e6d03816237fdf6febb9d8532a98cc193d Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 09:34:44 -0500 Subject: [PATCH 65/91] Create README.rst --- roles/0-init/README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 roles/0-init/README.rst diff --git a/roles/0-init/README.rst b/roles/0-init/README.rst new file mode 100644 index 000000000..d9c535ccb --- /dev/null +++ b/roles/0-init/README.rst @@ -0,0 +1,9 @@ +============= +0-init README +============= + +For a higher-level view, please see `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 `_ 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. From 4fb7988208f526ab6e5499accd982c4161e3f87e Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 09:38:23 -0500 Subject: [PATCH 66/91] Update main.yml --- roles/0-init/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index acdbc4c27..a16a68a29 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -102,7 +102,7 @@ # 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 -# MongoDB is auto-included by Sugarizer as of Feb 2019, thanks to roles/sugarizer/meta/main.yml +# 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 From b2417fb5f69bebdaf9b3fea4721b56a2efbcba13 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 10:09:14 -0500 Subject: [PATCH 67/91] Ansible syntax/indentations norms --- roles/minetest/tasks/main.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/minetest/tasks/main.yml b/roles/minetest/tasks/main.yml index 07feb26a6..e961eef81 100644 --- a/roles/minetest/tasks/main.yml +++ b/roles/minetest/tasks/main.yml @@ -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 }}" From 6137b3507f98d74b4182ac1d2a88d34e507eecc2 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Fri, 8 Feb 2019 16:17:20 -0500 Subject: [PATCH 68/91] put vars in global files copying them to local vars will break the install --- vars/default_vars.yml | 8 +++++++- vars/raspbian-9.yml | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 9ccf8078c..a461e4abc 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -440,7 +440,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/ diff --git a/vars/raspbian-9.yml b/vars/raspbian-9.yml index d4188f68c..d507e2f27 100644 --- a/vars/raspbian-9.yml +++ b/vars/raspbian-9.yml @@ -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 From e40da7b835e856a0bed6bba1df76c33c0396ccfb Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 21:48:33 -0500 Subject: [PATCH 69/91] Update README.rst --- roles/0-init/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/0-init/README.rst b/roles/0-init/README.rst index d9c535ccb..acceaff33 100644 --- a/roles/0-init/README.rst +++ b/roles/0-init/README.rst @@ -4,6 +4,6 @@ For a higher-level view, please see `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 `_ stage. +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. From a4a6ee9aacda131327f117ec976a327f064f08f5 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 21:51:42 -0500 Subject: [PATCH 70/91] Update README.rst --- roles/network/README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/network/README.rst b/roles/network/README.rst index e1969f4f8..394b7fde9 100644 --- a/roles/network/README.rst +++ b/roles/network/README.rst @@ -6,9 +6,9 @@ This is run by Ansible after it has installed the core of Internet-in-a-Box (IIA Specifically, this 'network' stage 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' 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``) +- 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' 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``) For more info, please see: From b5c5a43b13aa380af4709fbe623a19397581d78e Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 22:05:27 -0500 Subject: [PATCH 71/91] Update README.rst --- roles/network/README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/network/README.rst b/roles/network/README.rst index 394b7fde9..38c15f11c 100644 --- a/roles/network/README.rst +++ b/roles/network/README.rst @@ -10,10 +10,10 @@ Specifically, this 'network' stage is run: - 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' 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``) -For more info, please see: +Many IIAB networking questions can be answered in these 2 documents: -- https://github.com/iiab/iiab/wiki/IIAB-Networking -- http://FAQ.IIAB.IO including answers to common questions like: +- `IIAB Networking `_ is a high-level summary, that reviews IIAB's 3 modes of operation distinguishing WAN from LAN, `common ports `_, 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? From 72142db7b8ad9d6b7ea4afbb105b0e9d4e725eea Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 8 Feb 2019 22:08:07 -0500 Subject: [PATCH 72/91] Update README.rst --- roles/network/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/README.rst b/roles/network/README.rst index 38c15f11c..a4296ba1e 100644 --- a/roles/network/README.rst +++ b/roles/network/README.rst @@ -4,10 +4,10 @@ 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' stage is run: +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' stage (thanks to `iiab-from-console.yml <../../iiab-from-console.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: From cf1672177d499f6b15a6ae8a2c96adf97eed8202 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 13:12:45 -0500 Subject: [PATCH 73/91] Update README.rst --- roles/pbx/README.rst | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/roles/pbx/README.rst b/roles/pbx/README.rst index 69e95cbaf..12be0fa74 100644 --- a/roles/pbx/README.rst +++ b/roles/pbx/README.rst @@ -1,10 +1,10 @@ -=============== +========== PBX README -=============== +========== -Adds `Asterisk `_ and `FreePBX `_ to Internet-in-a-Box (IIAB) for VoIP and SIP functionality. +This 'pbx' playbook adds `Asterisk `_ and `FreePBX `_ 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. +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. @@ -16,11 +16,11 @@ Prior to installing IIAB, make sure your `/etc/iiab/local_vars.yml `_, 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:: +Optionally, you may want to enable `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 IIAB, please log in to http://pbx.lan and proceed with inital configuration. +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:: @@ -29,8 +29,4 @@ You can monitor the PBX service with command:: Attribution ----------- -The asterisk and freepbx playbooks have been heavily inspired by the work `here `_ and `here `_. -Dependencies ------------- - -1. This playbooks compiles and installs asterisk and freepbx from source, so running this feature involves significant bandwidth and compute time. +This 'pbx' playbook was heavily inspired by Yannik Sembritzki's `Asterisk `_ and `FreePBX `_ Ansible work. From f2e6b0edb9bb27c96842249850d5da63ca247e64 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 13:37:43 -0500 Subject: [PATCH 74/91] Update local_vars_min.yml --- vars/local_vars_min.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index f61650832..bd1624580 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -195,15 +195,11 @@ nodered_enabled: False nextcloud_install: False nextcloud_enabled: False -# A full featured PBX based on Asterisk and FreePBX -# -# Caution! -# This is a LARGE install that will compile from source and take lots of time. Handle with care! -# So far, supported on Ubuntu 18.x ONLY. +# 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 -#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: False From b12b2c783e056257b32ab9883140d8c24e516d01 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 13:38:34 -0500 Subject: [PATCH 75/91] Update local_vars_medium.yml --- vars/local_vars_medium.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index 98abc7904..eef642b78 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -195,15 +195,11 @@ nodered_enabled: False nextcloud_install: True nextcloud_enabled: True -# A full featured PBX based on Asterisk and FreePBX -# -# Caution! -# This is a LARGE install that will compile from source and take lots of time. Handle with care! -# So far, supported on Ubuntu 18.x ONLY. +# 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 -#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: True From 6cae8dd31ec5604e3af306ef2cad89b3371a1b69 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 13:39:19 -0500 Subject: [PATCH 76/91] Update local_vars_big.yml --- vars/local_vars_big.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index c1b3ca138..c8b819a79 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -195,15 +195,11 @@ nodered_enabled: True nextcloud_install: True nextcloud_enabled: True -# A full featured PBX based on Asterisk and FreePBX -# -# Caution! -# This is a LARGE install that will compile from source and take lots of time. Handle with care! -# So far, supported on Ubuntu 18.x ONLY. +# 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 -#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: True From ef99b880bee4dccb087e22122ed45df4f6e7d861 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 13:40:17 -0500 Subject: [PATCH 77/91] Update default_vars.yml --- vars/default_vars.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 6b91d4c29..15dab75fb 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -296,15 +296,11 @@ nodered_port: 1880 nextcloud_install: False nextcloud_enabled: False -# A full featured PBX based on Asterisk and FreePBX -# -# Caution! -# This is a LARGE install that will compile from source and take lots of time. Handle with care! -# So far, supported on Ubuntu 18.x ONLY. +# 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 -#nodejs_version: 10.x # If using WordPress intensively, set apache_high_php_limits in 3-BASE-SERVER wordpress_install: False From ddd267820977e36003724bd7a3d06bf65f1bf55e Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 13:54:32 -0500 Subject: [PATCH 78/91] Update freepbx_dependencies.yml --- roles/pbx/tasks/freepbx_dependencies.yml | 52 ++++++++++++------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/roles/pbx/tasks/freepbx_dependencies.yml b/roles/pbx/tasks/freepbx_dependencies.yml index dee24dede..18ce5d878 100644 --- a/roles/pbx/tasks/freepbx_dependencies.yml +++ b/roles/pbx/tasks/freepbx_dependencies.yml @@ -1,30 +1,30 @@ - name: FreePBX - Install dependencies package: name: - - wget - - git - - unixodbc # for asterisk cdr - - sudo # required by freepbx install script - - net-tools # fwconsole requirement - - cron # required by freepbx ucp package - - 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 + - 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 From a62e77c27f454915861c08c349015e885ce680ce Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 14:12:32 -0500 Subject: [PATCH 79/91] Update main.yml --- roles/pbx/tasks/main.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 2afa5025e..5ff30ecd1 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,14 +1,25 @@ - name: Fail if nodejs_version is incorrect - fail: - msg: "PBX: Refusing to install as nodejs_version is not 10.x. Fix that and rerun." + 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 -- name: Install asterisk - include_tasks: asterisk.yml - when: internet_available and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18) and pbx_install and (not pbx_installed) and (nodejs_version == "10.x") +- debug: + 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 improve + our coverage on other OS's/distros, Thank You! http://FAQ.IIAB.IO -- name: Install freepbx - include_tasks: freepbx.yml - when: internet_available and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18) and pbx_install and (not pbx_installed) and (nodejs_version == "10.x") +- 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 + include_tasks: freepbx.yml (debuntu) + 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) From 71a6b6c4527397eccb2f29b30a44eff8eb3a8b0f Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 14:14:39 -0500 Subject: [PATCH 80/91] Update main.yml --- roles/pbx/defaults/main.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index cdbaeec6e..1fa44b5cc 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -1,7 +1,11 @@ -pbx_install: False -pbx_enabled: False +# 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_chan_dongle: False asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/ asterisk_src_file: asterisk-16-current.tar.gz From f26277408ff70ef9c2656ef0a6445f70ea000a23 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 14:24:13 -0500 Subject: [PATCH 81/91] Update main.yml --- roles/pbx/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 5ff30ecd1..c2f19a690 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,6 +1,6 @@ - name: Fail if nodejs_version is incorrect fail: - msg: | + 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. @@ -9,7 +9,7 @@ #- name: TODO: Check if asterisk and freepbx are already installed - debug: - msg: | + 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 improve our coverage on other OS's/distros, Thank You! http://FAQ.IIAB.IO From 4d13eff7aa7e73d640df32aea46028b19b476eb9 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 14:42:27 -0500 Subject: [PATCH 82/91] Update asterisk.yml --- roles/pbx/tasks/asterisk.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index d10b0ec7d..c8fa14128 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -38,9 +38,9 @@ chdir: "{{ asterisk_src_dir }}" creates: "addons/mp3/mpg123.h" -- name: Install aptitude (otherwise install_prereq fails) +- name: Asterisk - Install aptitude (otherwise install_prereq fails?) package: - name: aptitude + name: aptitude state: latest - name: Asterisk - Ensure all dependencies are resolved @@ -68,29 +68,29 @@ args: chdir: "{{ asterisk_src_dir }}" -- name: Asterisk - Run 'make' +- name: Asterisk - Run 'make' - CAN TAKE 10 MIN OR LONGER! command: make args: chdir: "{{ asterisk_src_dir }}" creates: "defaults.h" -- name: Asterisk - install +- 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 - config +- name: Asterisk - Run 'make config' command: make config args: chdir: "{{ asterisk_src_dir }}" -- name: Asterisk - samples +- name: Asterisk - Run 'make samples' command: make samples args: chdir: "{{ asterisk_src_dir }}" -- name: Asterisk - ldconfig +- name: Asterisk - Run 'ldconfig' shell: ldconfig args: chdir: "{{ asterisk_src_dir }}" @@ -109,7 +109,7 @@ system: yes append: yes -- name: Asterisk - Set directory ownership +- 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 From c2cdd037eeb1b77cfc21b63c5c86d518f525d525 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 14:44:16 -0500 Subject: [PATCH 83/91] Update main.yml --- roles/pbx/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index c2f19a690..3c34fe71e 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -19,7 +19,7 @@ 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 - include_tasks: freepbx.yml (debuntu) +- 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) From 384230d5e9cd551eb18d5c0245cae8da80a37e44 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 14:54:22 -0500 Subject: [PATCH 84/91] Update asterisk.yml --- roles/pbx/tasks/asterisk.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/pbx/tasks/asterisk.yml b/roles/pbx/tasks/asterisk.yml index c8fa14128..20057ab0e 100644 --- a/roles/pbx/tasks/asterisk.yml +++ b/roles/pbx/tasks/asterisk.yml @@ -43,7 +43,7 @@ name: aptitude state: latest -- name: Asterisk - Ensure all dependencies are resolved +- 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 }}" @@ -95,12 +95,12 @@ args: chdir: "{{ asterisk_src_dir }}" -- name: Asterisk - Ensure group "asterisk" exists +- name: Asterisk - Ensure group 'asterisk' exists group: name: asterisk state: present -- name: Asterisk - Ensure user "asterisk" exists, and belongs to the required groups +- name: Asterisk - Ensure user 'asterisk' exists, and belongs to the required groups user: name: asterisk group: asterisk @@ -122,25 +122,25 @@ - /var/spool/asterisk - /usr/lib/asterisk -- name: Asterisk - Set default user to asterisk in /etc/default/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 +- 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 +- 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 +- name: Asterisk - Set default group to 'asterisk' in /etc/asterisk/asterisk.conf lineinfile: path: /etc/asterisk/asterisk.conf regexp: 'rungroup =' From 190b0d1a3e7e33f2794e50e5433fb92b0923e0e3 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 14:55:47 -0500 Subject: [PATCH 85/91] Update freepbx.yml --- roles/pbx/tasks/freepbx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/freepbx.yml b/roles/pbx/tasks/freepbx.yml index 7af404b41..30f6aa745 100644 --- a/roles/pbx/tasks/freepbx.yml +++ b/roles/pbx/tasks/freepbx.yml @@ -91,7 +91,7 @@ group: asterisk recurse: yes -- name: FreePBX - Install (just run once) +- name: FreePBX - Install (just run once) - CAN TAKE 2 MIN OR LONGER! command: "{{ item }}" args: chdir: "{{ freepbx_src_dir }}" From 5058eadb9d883e7d69e446aab6ff51e27b481f31 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 15:07:39 -0500 Subject: [PATCH 86/91] Update main.yml --- roles/pbx/tasks/main.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 3c34fe71e..671b0b612 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -1,6 +1,6 @@ - name: Fail if nodejs_version is incorrect fail: - msg: > + 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. @@ -9,10 +9,11 @@ #- name: TODO: Check if asterisk and freepbx are already installed - debug: - msg: > + 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 improve - our coverage on other OS's/distros, Thank You! http://FAQ.IIAB.IO + 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 From 74f29f54c129122776c6a6ea0044b7bd0209b609 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 15:37:13 -0500 Subject: [PATCH 87/91] Update main.yml --- roles/pbx/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 671b0b612..398618112 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -8,12 +8,13 @@ #- name: TODO: Check if asterisk and freepbx are already installed -- debug: +- 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 + http://FAQ.IIAB.IO ############################################################################### - name: Install Asterisk (debuntu) include_tasks: asterisk.yml From 956294c7da51e941a802855bbf3152d107bde07f Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 15:41:10 -0500 Subject: [PATCH 88/91] Update main.yml --- roles/pbx/tasks/main.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 398618112..a84c07f3e 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -10,11 +10,10 @@ - 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 ############################################################################### + ####################################################################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 From e2a5d3d34620bae2ffc5b611f86cc90384d8e4c1 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 15:42:36 -0500 Subject: [PATCH 89/91] Update main.yml --- roles/pbx/tasks/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index a84c07f3e..42fc3354d 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -13,7 +13,8 @@ ####################################################################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 ############################################################################### + and FreePBX work on other OS's / distros, Thank + You! http://FAQ.IIAB.IO ############################################################################### - name: Install Asterisk (debuntu) include_tasks: asterisk.yml From ed8fe004b1d8afb0a8508192fa3170f1ce6c989c Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 15:45:40 -0500 Subject: [PATCH 90/91] Update main.yml --- roles/pbx/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index 42fc3354d..a7851a631 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -12,8 +12,8 @@ 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 + 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) From b612937f8f6ae7e01669fb61e1622acfb8cdf6c5 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 9 Feb 2019 15:46:39 -0500 Subject: [PATCH 91/91] Update main.yml --- roles/pbx/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pbx/tasks/main.yml b/roles/pbx/tasks/main.yml index a7851a631..f7ab3946e 100644 --- a/roles/pbx/tasks/main.yml +++ b/roles/pbx/tasks/main.yml @@ -14,7 +14,7 @@ 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 ############################################################################### + You! http://FAQ.IIAB.IO ############################################################################### - name: Install Asterisk (debuntu) include_tasks: asterisk.yml