1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/pbx/tasks/asterisk.yml

152 lines
4.4 KiB
YAML
Raw Normal View History

- 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
2019-01-17 08:34:29 +00:00
extra_opts: [--strip-components=1]
2019-01-18 16:53:42 +00:00
creates: "{{ asterisk_src_dir }}/Makefile"
- name: Asterisk - Download mp3 decoder library into source tree
command: "./contrib/scripts/get_mp3_source.sh"
args:
2019-01-17 08:27:14 +00:00
chdir: "{{ asterisk_src_dir }}"
creates: "addons/mp3/mpg123.h"
2019-02-09 19:42:27 +00:00
- name: Asterisk - Install aptitude (otherwise install_prereq fails?)
package:
2019-02-09 19:42:27 +00:00
name: aptitude
state: latest
2019-02-09 19:54:22 +00:00
- name: Asterisk - Ensure all dependencies are resolved - CAN TAKE 2 MIN OR LONGER!
shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install
args:
2019-01-17 08:27:14 +00:00
chdir: "{{ asterisk_src_dir }}"
- name: Asterisk - Run the configure script
2019-02-07 14:11:19 +00:00
command: "./configure --with-jansson-bundled"
args:
2019-01-18 16:53:42 +00:00
chdir: "{{ asterisk_src_dir }}"
- name: Asterisk - Run make menuselect.makeopts
command: "make menuselect.makeopts"
args:
2019-01-17 08:27:14 +00:00
chdir: "{{ asterisk_src_dir }}"
2019-01-18 16:53:42 +00:00
creates: "menuselect.makeopts"
- name: Asterisk - Do a bit of menuselect configuration
command: >
menuselect/menuselect --enable app_macro --enable format_mp3
--enable CORE-SOUNDS-EN-WAV --enable CORE-SOUNDS-EN-G722
--enable EXTRA-SOUNDS-EN-WAV --enable EXTRA-SOUNDS-EN-G722 --enable EXTRA-SOUNDS-EN-GSM
--disable-category MENUSELECT_MOH
args:
2019-01-17 08:27:14 +00:00
chdir: "{{ asterisk_src_dir }}"
2019-02-09 19:42:27 +00:00
- name: Asterisk - Run 'make' - CAN TAKE 10 MIN OR LONGER!
command: make
args:
2019-01-17 08:27:14 +00:00
chdir: "{{ asterisk_src_dir }}"
2019-01-18 16:53:42 +00:00
creates: "defaults.h"
2019-02-09 19:42:27 +00:00
- name: Asterisk - Run 'make install' - CAN TAKE 3 MIN OR LONGER!
command: make install
args:
2019-01-17 08:27:14 +00:00
chdir: "{{ asterisk_src_dir }}"
2019-01-18 16:53:42 +00:00
creates: "/usr/sbin/asterisk"
2019-02-09 19:42:27 +00:00
- name: Asterisk - Run 'make config'
2019-01-20 06:22:12 +00:00
command: make config
args:
chdir: "{{ asterisk_src_dir }}"
2019-02-09 19:42:27 +00:00
- name: Asterisk - Run 'make samples'
2019-01-19 08:12:15 +00:00
command: make samples
args:
chdir: "{{ asterisk_src_dir }}"
2019-01-19 13:37:24 +00:00
2019-02-09 19:42:27 +00:00
- name: Asterisk - Run 'ldconfig'
2019-01-19 13:47:57 +00:00
shell: ldconfig
args:
2019-01-17 08:27:14 +00:00
chdir: "{{ asterisk_src_dir }}"
2019-02-09 19:54:22 +00:00
- name: Asterisk - Ensure group 'asterisk' exists
group:
name: asterisk
state: present
2019-02-09 19:54:22 +00:00
- 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
2019-02-09 19:42:27 +00:00
- name: 'Asterisk - Set ownership of 5 directories: /etc/asterisk, /var/lib/asterisk, /var/log/asterisk, /var/spool/asterisk, /usr/lib/asterisk'
file:
dest: "{{ item }}"
owner: asterisk
group: asterisk
recurse: yes
with_items:
- /etc/asterisk
- /var/lib/asterisk
- /var/log/asterisk
- /var/spool/asterisk
- /usr/lib/asterisk
2019-02-09 19:54:22 +00:00
- name: Asterisk - Set default user to 'asterisk' in /etc/default/asterisk
lineinfile:
path: /etc/default/asterisk
regexp: 'AST_USER='
line: 'AST_USER="asterisk"'
2019-02-09 19:54:22 +00:00
- name: Asterisk - Set default group to 'asterisk' in /etc/default/asterisk
lineinfile:
path: /etc/default/asterisk
regexp: 'AST_GROUP='
line: 'AST_GROUP="asterisk"'
2019-02-09 19:54:22 +00:00
- name: Asterisk - Set default user to 'asterisk' in /etc/asterisk/asterisk.conf
lineinfile:
path: /etc/asterisk/asterisk.conf
regexp: 'runuser ='
line: 'runuser = asterisk'
2019-02-09 19:54:22 +00:00
- name: Asterisk - Set default group to 'asterisk' in /etc/asterisk/asterisk.conf
lineinfile:
path: /etc/asterisk/asterisk.conf
regexp: 'rungroup ='
line: 'rungroup = asterisk'
- name: Asterisk - Install chan_dongle
include: chan_dongle.yml
when: asterisk_chan_dongle