Files
cgrates/data/ansible/calls/asterisk/main.yaml
2022-03-18 11:59:39 +01:00

141 lines
4.0 KiB
YAML

---
- hosts: all
vars:
ansible_python_interpreter: auto # to disable deprication warning related to the use of python2
###############################################################
##################### Golang Vars #############################
###############################################################
# Go language SDK version number
golang_version: '1.18'
go_version_target: "go version go{{ golang_version }} linux/amd64"
# Mirror to download the Go language SDK redistributable package from
golang_mirror: 'https://storage.googleapis.com/golang'
# Base installation directory the Go language SDK distribution
golang_install_dir: '/usr/local/go'
# Directory to store files downloaded for Go language SDK installation
golang_download_dir: "{{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}"
# Location for GOPATH environment variable
golang_gopath: "/home/{{ user }}/go"
# Filename of Go language SDK redistributable package
golang_redis_filename: 'go{{ golang_version }}.linux-amd64.tar.gz'
###############################################################
# CGRateS location
cgrates_dir: "{{ golang_gopath }}/src/github.com/cgrates/cgrates"
rootUser : root
dependencies:
- build-essential
- git
- redis-server
- mariadb-server
- postgresql
- postgresql-contrib
- python-dev
- gcc
- make
- binutils
- libasound2-dev
- autoconf
- openssl
- libssl-dev
- libxml2-dev
- libncurses5-dev
- uuid-dev
- sqlite3
- libsqlite3-dev
- pkg-config
- libedit-dev
customPath: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}"
remote_user: '{{ user }}'
tasks:
###########################################################################################################################
# install dependencies
- name: Install dependencies
become: yes
apt: name={{ dependencies }} state=present
###########################################################################################################################
# Install Golang
- name: install unarchive dependencies (zypper)
become: yes
zypper:
name:
- gzip
- tar
state: present
when: ansible_pkg_mgr == 'zypper'
- name: Install golang
include: go.yaml
###########################################################################################################################
# Install and config CGRateS
- name: Install and config CGRateS
include: cgrates.yaml
# Configure Asterisk
- name: Download Asterisk
become: yes
shell: "sudo wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz"
args:
chdir: '/tmp'
- name: Unzip Asterisk
become: yes
shell: "sudo tar xzvf asterisk-18-current.tar.gz"
args:
chdir: '/tmp'
- name: Configure Asterisk
become: yes
shell: "sudo ./configure --with-jansson-bundled"
args:
chdir: '/tmp/asterisk-18.5.0'
- name: Make Asterisk
become: yes
shell: "sudo make"
args:
chdir: '/tmp/asterisk-18.5.0'
- name: Make all Asterisk
become: yes
shell: "make all"
args:
chdir: '/tmp/asterisk-18.5.0'
- name: Make install Asterisk
become: yes
shell: "sudo make install"
args:
chdir: '/tmp/asterisk-18.5.0'
- name: Make samples Asterisk
become: yes
shell: "sudo make samples"
args:
chdir: '/tmp/asterisk-18.5.0'
- name: Make config Asterisk
become: yes
shell: "sudo make config"
args:
chdir: '/tmp/asterisk-18.5.0'
- name: Add user for Asterisk
become: yes
shell: 'sudo adduser --quiet --system --group --disabled-password --shell /bin/false --gecos "Asterisk" asterisk || true'
- name: Add user for CGRateS
become: yes
shell: 'sudo useradd cgrates'
# Configure PJSUA
- name: Config PJSUA
include: pjsua.yaml