mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-25 17:18:44 +05:00
Revise cgrates ansible role
Removed clone_repository variable from defaults. Now if it's not found we will assume it's true. In the cgrates building task we are not forcibly sourcing the /etc/profile script anymore since it's redundant (we are using bash -lc to execute the script, where -l will do that automatically). Make sure we create symbolic links for all binaries we build (not just cgr-engine). This meant the migrator task environment field could be removed as well.
This commit is contained in:
committed by
Dan Christian Bogos
parent
f2a3af6ddf
commit
48b375ab99
@@ -2,18 +2,18 @@
|
||||
- name: Set up environment in order to run call tests for Asterisk
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Install Go
|
||||
import_role:
|
||||
name: ../../roles/go
|
||||
- name: Install Go
|
||||
import_role:
|
||||
name: ../../roles/go
|
||||
|
||||
- name: Install and configure CGRateS
|
||||
import_role:
|
||||
name: ../../roles/install_cgrates
|
||||
- name: Install and configure CGRateS
|
||||
import_role:
|
||||
name: ../../roles/cgrates
|
||||
|
||||
- name: Install Asterisk
|
||||
import_role:
|
||||
name: ../../roles/install_asterisk
|
||||
- name: Install Asterisk
|
||||
import_role:
|
||||
name: ../../roles/install_asterisk
|
||||
|
||||
- name: Install PJSUA
|
||||
import_role:
|
||||
name: ../../roles/install_pjsua
|
||||
- name: Install PJSUA
|
||||
import_role:
|
||||
name: ../../roles/install_pjsua
|
||||
|
||||
@@ -11,19 +11,19 @@
|
||||
|
||||
- name: Install and config CGRateS
|
||||
import_role:
|
||||
name: ../../roles/install_cgrates
|
||||
name: ../../roles/cgrates
|
||||
|
||||
- name: Unzip FreeSWITCH config
|
||||
- name: Unzip FreeSWITCH config
|
||||
become: yes
|
||||
shell: 'sudo tar -xvf freeswitch_conf.tar.gz'
|
||||
shell: "sudo tar -xvf freeswitch_conf.tar.gz"
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}/data/tutorial_tests/fs_evsock/freeswitch/etc'
|
||||
chdir: "{{ cgrates_dir }}/data/tutorial_tests/fs_evsock/freeswitch/etc"
|
||||
|
||||
- name: Unzip FreeSWITCH config 2
|
||||
- name: Unzip FreeSWITCH config 2
|
||||
become: yes
|
||||
shell: 'sudo tar -xvf freeswitch_conf.tar.gz'
|
||||
shell: "sudo tar -xvf freeswitch_conf.tar.gz"
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}/data/tutorials/fs_evsock/freeswitch/etc'
|
||||
chdir: "{{ cgrates_dir }}/data/tutorials/fs_evsock/freeswitch/etc"
|
||||
|
||||
- name: Update internal.xml with the correct IP
|
||||
ansible.builtin.replace:
|
||||
@@ -31,17 +31,17 @@
|
||||
regexp: '192\.168\.56\.203'
|
||||
replace: "{{ ansible_host }}"
|
||||
|
||||
- name: Remove FreeSWITCH default config from /etc/freeswitch
|
||||
- name: Remove FreeSWITCH default config from /etc/freeswitch
|
||||
become: yes
|
||||
shell: 'sudo rm -rf *'
|
||||
shell: "sudo rm -rf *"
|
||||
args:
|
||||
chdir: '/etc/freeswitch'
|
||||
chdir: "/etc/freeswitch"
|
||||
|
||||
- name: Copy our custom config for FreeSWITCH in /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'
|
||||
shell: "sudo cp -r {{ cgrates_dir }}/data/tutorial_tests/fs_evsock/freeswitch/etc/freeswitch/* /etc/freeswitch"
|
||||
args:
|
||||
chdir: '/etc/freeswitch'
|
||||
chdir: "/etc/freeswitch"
|
||||
|
||||
- name: Configure PJSUA
|
||||
import_role:
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
---
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Install Kamailio
|
||||
import_role:
|
||||
name: ../../roles/install_kamailio
|
||||
- name: Install Kamailio
|
||||
import_role:
|
||||
name: ../../roles/install_kamailio
|
||||
|
||||
- name: Install Go
|
||||
import_role:
|
||||
name: ../../roles/go
|
||||
- name: Install Go
|
||||
import_role:
|
||||
name: ../../roles/go
|
||||
|
||||
- name: Install and configure CGRateS
|
||||
import_role:
|
||||
name: ../../roles/install_cgrates
|
||||
- name: Install and configure CGRateS
|
||||
import_role:
|
||||
name: ../../roles/cgrates
|
||||
|
||||
- name: Install PJSUA
|
||||
import_role:
|
||||
name: ../../roles/install_pjsua
|
||||
- name: Install PJSUA
|
||||
import_role:
|
||||
name: ../../roles/install_pjsua
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
|
||||
- name: Install and configure CGRateS
|
||||
import_role:
|
||||
name: ../roles/install_cgrates
|
||||
name: ../roles/cgrates
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
mode: "u=rwx,go=rx"
|
||||
owner: "{{ ansible_user }}"
|
||||
dest: "{{ cgrates_dir }}"
|
||||
when: "clone_repository|bool"
|
||||
when: clone_repository | bool | default(true)
|
||||
|
||||
- name: Git clone cgrates
|
||||
ansible.builtin.git:
|
||||
@@ -22,11 +22,11 @@
|
||||
update: yes
|
||||
force: yes
|
||||
version: "{{ git_version }}"
|
||||
when: "clone_repository|bool"
|
||||
when: clone_repository | bool | default(true)
|
||||
|
||||
- name: Build cgrates
|
||||
ansible.builtin.command:
|
||||
cmd: bash -lc "source /etc/profile.d/golang.sh && sh {{ cgrates_dir }}/build.sh"
|
||||
ansible.builtin.shell:
|
||||
cmd: bash -lc "sh {{ cgrates_dir }}/build.sh"
|
||||
args:
|
||||
chdir: "{{ cgrates_dir }}"
|
||||
become_user: "{{ ansible_user }}"
|
||||
@@ -40,9 +40,13 @@
|
||||
loop:
|
||||
- { src: "{{ cgrates_dir }}/data", dest: "/usr/share/cgrates" }
|
||||
- { src: "{{ golang_gopath }}/bin/cgr-engine", dest: "/usr/bin/cgr-engine" }
|
||||
- { src: "{{ golang_gopath }}/bin/cgr-loader", dest: "/usr/bin/cgr-loader" }
|
||||
- { src: "{{ golang_gopath }}/bin/cgr-migrator", dest: "/usr/bin/cgr-migrator" }
|
||||
- { src: "{{ golang_gopath }}/bin/cgr-console", dest: "/usr/bin/cgr-console" }
|
||||
- { src: "{{ golang_gopath }}/bin/cgr-tester", dest: "/usr/bin/cgr-tester" }
|
||||
|
||||
- name: Run post install scripts
|
||||
ansible.builtin.shell:
|
||||
ansible.builtin.command:
|
||||
cmd: "{{ item.cmd }}"
|
||||
chdir: "{{ cgrates_dir }}/data/storage/{{ item.db }}"
|
||||
become: yes
|
||||
@@ -54,7 +58,5 @@
|
||||
- { db: "mongo", cmd: "sh setup_cgr_db.sh" }
|
||||
|
||||
- name: Set versions
|
||||
ansible.builtin.shell:
|
||||
ansible.builtin.command:
|
||||
cmd: "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 }}"
|
||||
Reference in New Issue
Block a user