mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
153 lines
4.6 KiB
YAML
153 lines
4.6 KiB
YAML
# 2021-08-03: Not nec on Debian 11, and hopefully other OS's likewise
|
|
#- name: Asterisk - Install dependencies
|
|
# include: asterisk_dependencies.yml
|
|
|
|
- name: Asterisk - Download software to /opt/iiab/downloads
|
|
get_url:
|
|
url: "{{ asterisk_url }}/{{ asterisk_src_file }}"
|
|
dest: "{{ downloads_dir }}/{{ asterisk_src_file }}"
|
|
timeout: "{{ download_timeout }}"
|
|
when: internet_available
|
|
|
|
- name: Asterisk - Check for /opt/iiab/downloads/{{ asterisk_src_file }}
|
|
stat:
|
|
path: "{{ downloads_dir }}/{{ asterisk_src_file }}"
|
|
register: asterisk_src
|
|
|
|
- name: Asterisk - FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ asterisk_src_file }} doesn't exist
|
|
fail:
|
|
msg: "{ downloads_dir }}/{{ asterisk_src_file }} is REQUIRED in order to install."
|
|
when: not asterisk_src.stat.exists
|
|
|
|
- name: Asterisk - Create install source directory
|
|
file:
|
|
path: "{{ asterisk_src_dir }}"
|
|
state: directory
|
|
|
|
- name: Asterisk - Extract source
|
|
unarchive:
|
|
src: "{{ downloads_dir }}/{{ asterisk_src_file }}"
|
|
dest: "{{ asterisk_src_dir }}"
|
|
owner: root
|
|
group: root
|
|
extra_opts: [--strip-components=1]
|
|
creates: "{{ asterisk_src_dir }}/Makefile"
|
|
|
|
# 2021-08-03: Asterisk's install_prereq script (stanza just below) installs
|
|
# 'aptitude' regardless, within handle_debian() here:
|
|
# https://github.com/asterisk/asterisk/blob/master/contrib/scripts/install_prereq#L262-L271
|
|
#
|
|
#- name: Asterisk - Install aptitude (otherwise install_prereq fails?)
|
|
# package:
|
|
# name: aptitude
|
|
# state: latest
|
|
|
|
- name: Asterisk - Ensure all dependencies are resolved - CAN TAKE 5 MIN OR LONGER!
|
|
shell: export DEBIAN_FRONTEND=noninteractive && ./contrib/scripts/install_prereq install
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
|
|
# 2021-08-03: Requires subversion (installed just above)
|
|
- 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 - Run the configure script
|
|
command: ./configure --with-jansson-bundled
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
|
|
- name: Asterisk - Run make menuselect.makeopts
|
|
command: make menuselect.makeopts
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
creates: menuselect.makeopts
|
|
|
|
- name: Asterisk - Do a bit of menuselect configuration
|
|
command: >
|
|
menuselect/menuselect --enable app_macro --enable format_mp3
|
|
--enable CORE-SOUNDS-EN-WAV --enable CORE-SOUNDS-EN-G722
|
|
--enable EXTRA-SOUNDS-EN-WAV --enable EXTRA-SOUNDS-EN-G722 --enable EXTRA-SOUNDS-EN-GSM
|
|
--disable-category MENUSELECT_MOH
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
|
|
- name: Asterisk - Run 'make' - CAN TAKE 30 MIN OR LONGER!
|
|
command: make
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
creates: defaults.h
|
|
|
|
- name: Asterisk - Run 'make install' - CAN TAKE 2 MIN OR LONGER!
|
|
command: make install
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
creates: /usr/sbin/asterisk
|
|
|
|
- name: Asterisk - Run 'make config'
|
|
command: make config
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
|
|
- name: Asterisk - Run 'make samples'
|
|
command: make samples
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
|
|
- name: Asterisk - Run 'ldconfig'
|
|
shell: ldconfig
|
|
args:
|
|
chdir: "{{ asterisk_src_dir }}"
|
|
|
|
- name: Asterisk - Ensure group 'asterisk' exists
|
|
group:
|
|
name: asterisk
|
|
state: present
|
|
|
|
- name: Asterisk - Ensure user 'asterisk' exists, and belongs to the required groups
|
|
user:
|
|
name: asterisk
|
|
group: asterisk
|
|
groups: audio,dialout
|
|
home: /var/lib/asterisk
|
|
system: yes
|
|
append: yes
|
|
|
|
- name: "Asterisk - Set ownership of 5 directories: /etc/asterisk, /var/lib/asterisk, /var/log/asterisk, /var/spool/asterisk, /usr/lib/asterisk (asterisk:asterisk)"
|
|
file:
|
|
dest: "{{ item }}"
|
|
owner: asterisk
|
|
group: asterisk
|
|
recurse: yes
|
|
with_items:
|
|
- /etc/asterisk
|
|
- /var/lib/asterisk
|
|
- /var/log/asterisk
|
|
- /var/spool/asterisk
|
|
- /usr/lib/asterisk
|
|
|
|
- name: Asterisk - Set default user to 'asterisk' in /etc/default/asterisk
|
|
lineinfile:
|
|
path: /etc/default/asterisk
|
|
regexp: 'AST_USER='
|
|
line: 'AST_USER="asterisk"'
|
|
|
|
- name: Asterisk - Set default group to 'asterisk' in /etc/default/asterisk
|
|
lineinfile:
|
|
path: /etc/default/asterisk
|
|
regexp: 'AST_GROUP='
|
|
line: 'AST_GROUP="asterisk"'
|
|
|
|
- name: Asterisk - Set default user to 'asterisk' in /etc/asterisk/asterisk.conf
|
|
lineinfile:
|
|
path: /etc/asterisk/asterisk.conf
|
|
regexp: 'runuser ='
|
|
line: 'runuser = asterisk'
|
|
|
|
- name: Asterisk - Set default group to 'asterisk' in /etc/asterisk/asterisk.conf
|
|
lineinfile:
|
|
path: /etc/asterisk/asterisk.conf
|
|
regexp: 'rungroup ='
|
|
line: 'rungroup = asterisk'
|