---
- hosts: localhost
  vars:
    password: rolaids
  tasks:
    - name: Create Turn configuration volume 1/2
      docker_volume:
        name: turn_config

    - name: Create Turn configuration volume 2/2
      docker_volume:
        name: turn_config2

    - name: Create network interface
      command: /usr/bin/ip addr add 192.168.1.63/24 dev enp2s0
      ignore_errors: True

    - name: Start turn server
      docker_container:
        name: echo
        hostname: echo
        recreate: yes
        image: coturn/coturn
        ports:
            - "192.168.1.63:3478:3478"
            - "192.168.1.63:3478:3478/udp"
            - "192.168.1.63:5349:5349"
            - "192.168.1.63:5349:5349/udp"
            - "192.168.1.63:49150-49200:49150-49200/udp"
        volumes:
            - turn_config2:/etc/coturn/
            - turn_config:/var/lib/coturn
        memory: 8G
        restart_policy: unless-stopped
