---
- include_vars: secrets.yml

- name: Install FreeSwitch
  yum:
    name: kazoo-freeswitch
    state: latest

- name: Stop and Disable Default FreeSwitch
  service:
    name: freeswitch
    state: stopped
    enabled: no

- name: Create Kazoo Configuration
  template:
    src: kazoo.conf.xml.j2
    dest: /etc/kazoo/freeswitch/autoload_configs/kazoo.conf.xml
  notify: Gracefully Restart FreeSwitch

- name: Start and Enable FreeSwitch
  service:
    name: kazoo-freeswitch
    state: started
    enabled: yes

- name: Allow Freeswitch Erlang Socket
  firewalld:
    port: 8031/tcp
    permanent: true
    immediate: true
    state: enabled

- name: Allow FreeSwitch SIP TCP
  firewalld:
    port: 11000/tcp
    permanent: true
    immediate: true
    state: enabled

- name: Allow FreeSwitch SIP UDP
  firewalld:
    port: 11000/udp
    permanent: true
    immediate: true
    state: enabled

- name: Allow FreeSwitch RTP
  firewalld:
    port: 16384-32768/udp
    permanent: true
    immediate: true
    state: enabled


---
- include_vars: secrets.yml

- name: Install FreeSwitch
  yum:
    name: kazoo-freeswitch
    state: latest

- name: Stop and Disable Default FreeSwitch
  service:
    name: freeswitch
    state: stopped
    enabled: no

- name: Create Kazoo Configuration
  template:
    src: kazoo.conf.xml.j2
    dest: /etc/kazoo/freeswitch/autoload_configs/kazoo.conf.xml
  notify: Gracefully Restart FreeSwitch

- name: Start and Enable FreeSwitch
  service:
    name: kazoo-freeswitch
    state: started
    enabled: yes

- name: Allow Freeswitch Erlang Socket TCP
  firewalld:
    port: 8031/tcp
    permanent: true
    immediate: true
    state: enabled

- name: Allow Freeswitch Erlang Socket UDP
  firewalld:
    port: 8031/udp
    permanent: true
    immediate: true
    state: enabled

- name: Allow epmd Port
  firewalld:
    port: 4369/tcp
    permanent: true
    immediate: true
    state: enabled

- name: Allow Distributed Erlang Ports
  firewalld:
    port: 11500-11999/tcp
    permanent: true
    immediate: true
    state: enabled

- name: Allow FreeSwitch SIP TCP
  firewalld:
    port: 11000/tcp
    permanent: true
    immediate: true
    state: enabled

- name: Allow FreeSwitch SIP UDP
  firewalld:
    port: 11000/udp
    permanent: true
    immediate: true
    state: enabled

- name: Allow FreeSwitch RTP
  firewalld:
    port: 16384-32768/udp
    permanent: true
    immediate: true
    state: enabled


Add Distributed Erlang Ports for Freeswitch
Add Distributed Erlang Ports for Freeswitch
