Modified Ansible script for asterisk

This commit is contained in:
andronache
2021-06-23 16:06:10 +03:00
committed by Dan Christian Bogos
parent cad6869e25
commit b5a2d677dc
12 changed files with 68 additions and 32 deletions

View File

@@ -32,14 +32,21 @@
dest: "/usr/share/cgrates"
state: link
- name: symbol link
- name: symbol link 2
become: yes
file:
src: "{{ golang_gopath }}/bin/cgr-engine"
dest: "/usr/bin/cgr-engine"
state: link
# post install
- name: post install mysql
- name: post install for ers mysql
become: yes
command: 'sh {{ cgrates_dir }}/data/storage/mysql/setup_ers_db.sh root CGRateS.org localhost'
args:
chdir: '{{ cgrates_dir }}/data/storage/mysql/'
- name: post install mysql
become: yes
command: 'sh {{ cgrates_dir }}/data/storage/mysql/setup_cgr_db.sh root CGRateS.org localhost'
args:
@@ -50,3 +57,20 @@
command: 'sh {{ cgrates_dir }}/data/storage/postgres/create_db_with_users.sh'
args:
chdir: '{{ cgrates_dir }}/data/storage/postgres/'
- name: post install for ers postgres
become: yes
command: 'sh {{ cgrates_dir }}/data/storage/postgres/create_ers_db.sh'
args:
chdir: '{{ cgrates_dir }}/data/storage/postgres/'
- name: post install mongo
become: yes
command: 'sh {{ cgrates_dir }}/data/storage/mongo/setup_cgr_db.sh'
args:
chdir: '{{ cgrates_dir }}/data/storage/mongo/'
- name: set versions
command: 'cgr-migrator -exec=*set_versions -config_path=/usr/share/cgrates/conf/samples/tutmysql'
environment:
PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}"

View File

@@ -5,7 +5,7 @@
##################### Golang Vars #############################
###############################################################
# Go language SDK version number
golang_version: '1.16.3'
golang_version: '1.16.5'
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'
@@ -38,7 +38,6 @@
- autoconf
- openssl
- libssl-dev
- libsrtp-dev
- libxml2-dev
- libncurses5-dev
- uuid-dev
@@ -77,27 +76,15 @@
include: cgrates.yaml
# Configure Asterisk
- name: Download files for asterisk
become: yes
shell: "sudo wget --no-check-certificate https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.7.2/pjproject-2.7.2.tar.bz2"
args:
chdir: '/tmp'
- name: Download files for asterisk
become: yes
shell: "sudo wget --no-check-certificate https://raw.githubusercontent.com/asterisk/third-party/master/jansson/2.11/jansson-2.11.tar.bz2"
args:
chdir: '/tmp'
- name: Download Asterisk
become: yes
shell: "sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz"
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-16-current.tar.gz"
shell: "sudo tar xzvf asterisk-18-current.tar.gz"
args:
chdir: '/tmp'
@@ -105,24 +92,48 @@
become: yes
shell: "sudo ./configure --with-jansson-bundled"
args:
chdir: '/tmp/asterisk-16.5.1'
chdir: '/tmp/asterisk-18.4.0'
- name: Make Asterisk
become: yes
shell: "sudo make"
args:
chdir: '/tmp/asterisk-16.5.1'
chdir: '/tmp/asterisk-18.4.0'
- name: Make all Asterisk
become: yes
shell: "make all"
args:
chdir: '/tmp/asterisk-18.4.0'
- name: Make install Asterisk
become: yes
shell: "sudo make install"
args:
chdir: '/tmp/asterisk-16.5.1'
chdir: '/tmp/asterisk-18.4.0'
- name: Make samples Asterisk
become: yes
shell: "sudo make samples"
args:
chdir: '/tmp/asterisk-18.4.0'
- name: Make config Asterisk
become: yes
shell: "sudo make config"
args:
chdir: '/tmp/asterisk-18.4.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

View File

@@ -1,13 +1,13 @@
---
- name: Download PJSUA
become: yes
shell: 'sudo wget https://www.pjsip.org/release/2.9/pjproject-2.9.tar.bz2'
shell: 'sudo wget https://github.com/pjsip/pjproject/archive/refs/tags/2.9.tar.gz'
args:
chdir: '/tmp'
- name: Unzip PJSUA
become: yes
shell: 'sudo tar -xvf pjproject-2.9.tar.bz2'
shell: 'sudo tar -xvf 2.9.tar.gz'
args:
chdir: '/tmp'
@@ -26,3 +26,4 @@
shell: 'sudo mv pjsua-x86_64-unknown-linux-gnu /usr/bin/pjsua'
args:
chdir: '/tmp/pjproject-2.9/pjsip-apps/bin'

View File

@@ -81,7 +81,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -81,7 +81,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -72,7 +72,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -72,7 +72,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -81,7 +81,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -81,7 +81,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -72,7 +72,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -72,7 +72,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}

View File

@@ -81,7 +81,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test\
|| return 1
start-stop-daemon --start --quiet --chuid $USER:$GROUP --make-pidfile --pidfile $PIDFILE --background\
--startas /bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
--startas /usr/bin/bash -- -c "exec $DAEMON $DAEMON_OPTS >> $STACKTRACE 2>&1" \
|| return 2
}