Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial draft for adding stun server deployment #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions roles/stunserver/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# defaults file for stunserver
stun_start_daemon: true
stun_daemon_opts: ""
stun_primary_ip: ""
stun_secondary_ip: ""
stun_primary_port: 3478
stun_secondary_port: 3479
stun_daemon_user: nobody
2 changes: 2 additions & 0 deletions roles/stunserver/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for stunserver
53 changes: 53 additions & 0 deletions roles/stunserver/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to fill these fields? Otherwise I would drop them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The meta information is only relevant for ansible galaxy in case we push it there.


# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)

min_ansible_version: 2.9

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99

galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove the comments if we are done with the file

11 changes: 11 additions & 0 deletions roles/stunserver/tasks/install-stunserver-debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

- name: Install STUN server package
package:
name: stunserver
state: present

- name: Configure STUN Server
template:
src: stun.j2
dest: /etc/defaults/stun
16 changes: 16 additions & 0 deletions roles/stunserver/tasks/install-stunserver-redhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

- name: Install EPEL
package:
name: epel-release
state: present

- name: Install STUN Server
package:
name: stun-server
state: present

- name: Configure STUN Server
template:
src: stun.j2
dest: /etc/sysconfig/stun
11 changes: 11 additions & 0 deletions roles/stunserver/tasks/install-stunserver-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

- name: Install STUN server package
package:
name: stunserver
state: present

- name: Configure STUN Server
template:
src: stun.j2
dest: /etc/defaults/stun
11 changes: 11 additions & 0 deletions roles/stunserver/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---


- name: Install Stun Server
include_tasks: "install-stunserver-{{ ansible_os_family | lower }}.yml"

- name: Start STUN Server
systemd:
name: stun
enabled: true
state: started
21 changes: 21 additions & 0 deletions roles/stunserver/templates/stun.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Defaults for stun initscript
# sourced by /etc/init.d/stun
# installed at /etc/default/stun by the maintainer scripts

#
# This is a POSIX shell fragment
#

#uncommment the next line to allow the init.d script to start the stun daemon
START_DAEMON={{ stun_start_daemon }}

# Additional options that are passed to the Daemon.
DAEMON_OPTS="{{ stun_daemon_opts }}"

PRIMARY_IP="{{ stun_primary_ip }}"
SECONDARY_IP="{{ stun_secondary_ip }}"
PRIMARY_PORT={{ stun_primary_port }}
SECONDARY_PORT={{ stun_seconday_port }}

# whom the daemons should run as
DAEMON_USER={{ stun_daemon_user }}
2 changes: 2 additions & 0 deletions roles/stunserver/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions roles/stunserver/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- stunserver
2 changes: 2 additions & 0 deletions roles/stunserver/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for stunserver