-
Notifications
You must be signed in to change notification settings - Fork 25
/
federated-sip.yml
153 lines (130 loc) · 4.94 KB
/
federated-sip.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
---
- name: Federated SIP setup
hosts: federated-servers
vars_files:
- variables.yml
sudo: true
tasks:
- name: install vim
yum: name=vim-enhanced
- name: install epel
yum: name=epel-release
- name: install opensips repo
yum: name=http://yum.opensips.org/2.4/releases/el/7/x86_64/opensips-yum-releases-2.4-3.el7.noarch.rpm
- group: name=opensips state=present
- user: name=opensips createhome=no group=opensips
- name: "Install required opensips packages"
yum: state=present name={{ item }}
with_items:
- opensips
- opensips-db_sqlite
- opensips-proto_tls
- opensips-proto_ws
- opensips-proto_wss
- opensips-rtpengine
- opensips-tls_mgm
- name: install rtpengine deps
yum: state=present name={{ item }}
with_items:
- git
- gcc
- make
- flex
- bison
- gettext
- automake
- autoconf
- gdb
- libtool
- binutils
- pkgconfig
- glib2
- glib2-devel
- zlib
- zlib-devel
- openssl
- openssl-devel
- pcre
- pcre-devel
- libcurl
- libcurl-devel
- xmlrpc-c
- xmlrpc-c-devel
- hiredis
- hiredis-devel
- libpcap-devel
- libevent-devel
- json-glib-devel
- iptables-devel
- name: install sqlite pcre extension deps
yum: state=present name={{ item }}
with_items:
- sqlite
- sqlite-devel
- name: Stopping rtpengine
service: name=rtpengine state=stopped
when: firstrun == 'false'
- name: Stopping opensips
service: name=opensips state=stopped
when: firstrun == 'false'
- git: repo=https://github.com/sipwise/rtpengine.git
dest=/usr/local/src/rtpengine
version=mr6.2.1
- git: repo=https://github.com/ralight/sqlite3-pcre.git
dest=/usr/local/src/sqlite3-pcre
- name: Running make for rtpengine
command: "{{ item }} chdir=/usr/local/src/rtpengine/daemon"
environment:
with_transcoding: no
with_items:
- make
- name: Running make install for rtpengine
command: "cp rtpengine /usr/sbin/rtpengine chdir=/usr/local/src/rtpengine/daemon"
- name: Running make for sqlite3-pcre
command: "{{ item }} chdir=/usr/local/src/sqlite3-pcre/"
with_items:
- make
- name: Running make install for sqlite3-pcre
command: "make install chdir=/usr/local/src/sqlite3-pcre/"
- name: Copying opensips configuration
template: src=templates/opensips.cfg.j2 dest=/etc/opensips/opensips.cfg
mode=0644
- name: Copying opensips environment files
copy: src=files/opensips.sysconfig dest=/etc/sysconfig/opensips
- name: Copying opensips control config
copy: src=files/opensipsctlrc dest=/etc/opensips/opensipsctlrc
- name: Copying opensips service script
copy: src=files/opensips.service dest=/etc/systemd/system/opensips.service
- name: Copying rtpengine environment files
template: src=templates/rtpengine.sysconfig.j2 dest=/etc/sysconfig/rtpengine
- name: Copying rtpengine service script
copy: src=files/rtpengine.service dest=/etc/systemd/system/rtpengine.service
- git: repo=https://github.com/OpenSIPS/opensips.git
dest=/usr/local/src/opensips
- file: path=/var/db/opensips state=directory mode=0755 group=opensips owner=opensips
- file: path=/var/db/opensips state=directory mode=0777
- name: Copying translations table sql create script
copy: src=files/create_translations_table.sqlite dest=/usr/local/src/create_translations_table.sqlite
- name: Creating opensips database
shell: "sqlite3 /var/db/opensips/opensips < /usr/local/src/opensips/scripts/sqlite/standard-create.sql"
when: firstrun == 'true'
- name: Creating dialog table
shell: "sqlite3 /var/db/opensips/opensips < /usr/local/src/opensips/scripts/sqlite/dialog-create.sql"
when: firstrun == 'true'
- name: Creating location table
shell: "sqlite3 /var/db/opensips/opensips < /usr/local/src/opensips/scripts/sqlite/usrloc-create.sql"
when: firstrun == 'true'
- name: Creating domain table
shell: "sqlite3 /var/db/opensips/opensips < /usr/local/src/opensips/scripts/sqlite/domain-create.sql"
when: firstrun == 'true'
- name: Creating subscriber table
shell: "sqlite3 /var/db/opensips/opensips < /usr/local/src/opensips/scripts/sqlite/auth_db-create.sql"
when: firstrun == 'true'
- name: Creating translations table
shell: "sqlite3 /var/db/opensips/opensips < /usr/local/src/create_translations_table.sqlite"
when: firstrun == 'true'
- file: path=/var/db/opensips/opensips state=file mode=0777 group=opensips owner=opensips
- name: Starting rtpengine
service: name=rtpengine state=started
- name: Starting opensips
service: name=opensips state=started