--- - 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.16.6' 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 freeswitch_packages: - freeswitch-meta-all - freeswitch-mod-json-cdr dependencies: - build-essential - git - redis-server - mariadb-server - postgresql - postgresql-contrib - python-dev - gcc - make - binutils - libasound2-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 - name: Add key for freeswitch become: yes apt_key: url=https://files.freeswitch.org/repo/deb/debian-release/fsstretch-archive-keyring.asc state=present - name: Add FreeSwitch apt repository become: yes apt_repository: repo: deb [ allow-insecure=yes ] http://files.freeswitch.org/repo/deb/debian-release/ buster main state: present filename: 'freeswitch' - name: Add FreeSwitch apt repository (1.8) (Debian 8/Jessie) become: yes apt_repository: repo: deb-src http://files.freeswitch.org/repo/deb/debian-release/ buster main state: present filename: 'freeswitch' # Install FreeSwitch - name: Install FreeSwitch become: yes apt: name={{ freeswitch_packages }} state=latest ########################################################################################################################### # 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 FreeSwitch - name: Unzip FreeSWITCH config become: yes shell: 'sudo tar -xvf freeswitch_conf.tar.gz' args: chdir: '{{ cgrates_dir }}/data/tutorial_tests/fs_evsock/freeswitch/etc' - name: Unzip FreeSWITCH config 2 become: yes shell: 'sudo tar -xvf freeswitch_conf.tar.gz' args: chdir: '{{ cgrates_dir }}/data/tutorials/fs_evsock/freeswitch/etc' - name: Remove FreeSWITCH default config from /etc/freeswitch become: yes shell: 'sudo rm -rf *' args: chdir: '/etc/freeswitch' - name: Copy our custom config for FreeSWITCH in /etc/freeswitch become: yes shell: 'sudo cp -r {{ cgrates_dir }}/data/tutorial_tests/fs_evsock/freeswitch/etc/freeswitch/* /etc/freeswitch' args: chdir: '/etc/freeswitch' - name: Add user for CGRateS become: yes shell: 'sudo useradd cgrates' # Configure PJSUA - name: Config PJSUA include: pjsua.yaml