1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/pbx/tasks/install.yml

71 lines
2.1 KiB
YAML

- name: "ONLY PHP 7.4 IS SUPPORTED AS OF MAY 2022 -- PLEASE READ: https://github.com/iiab/iiab/tree/master/roles/pbx#readme"
meta: noop
- name: "Set 'nodejs_install: True' and 'nodejs_enabled: True'"
set_fact:
nodejs_install: True
nodejs_enabled: True
- name: NODEJS - run 'nodejs' role (attempt to install & enable Node.js)
include_role:
name: nodejs
- name: FAIL (STOP THE INSTALL) IF 'nodejs_installed is undefined'
fail:
msg: "PBX install cannot proceed, as Node.js is not installed."
when: nodejs_installed is undefined
# - name: FAIL (STOP THE INSTALL) IF 'nodejs_version != "12.x"'
# fail:
# msg: "PBX install cannot proceed, as it currently requires Node.js 12.x, whereas nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml, /etc/iiab/local_vars.yml, /opt/iiab/iiab/roles/nodejs, etc."
# when: nodejs_version != "12.x"
- name: Record (initial) disk space used
shell: df -B1 --output=used / | tail -1
register: df1
# 2021-08-09: Moved to roles/pbx/tasks/apache.yml
# - name: "Set 'apache_install: True' and 'apache_enabled: True'"
# set_fact:
# apache_install: True
# apache_enabled: True
# - name: APACHE - run 'httpd' role
# include_role:
# name: httpd
- name: Install Asterisk
include_tasks: asterisk.yml
when: asterisk_installed is undefined
- name: Install FreePBX
include_tasks: freepbx.yml
# RECORD PBX AS INSTALLED
- name: Record (final) disk space used
shell: df -B1 --output=used / | tail -1
register: df2
- name: Add 'pbx_disk_usage = {{ df2.stdout|int - df1.stdout|int }}' to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: pbx
option: pbx_disk_usage
value: "{{ df2.stdout|int - df1.stdout|int }}"
- name: "Set 'pbx_installed: True'"
set_fact:
pbx_installed: True
- name: "Add 'pbx_installed: True' to {{ iiab_state_file }}"
lineinfile:
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
regexp: '^pbx_installed'
line: 'pbx_installed: True'