Initial commit

This commit is contained in:
2026-06-02 15:21:39 -04:00
commit d83c4388df
9 changed files with 265 additions and 0 deletions

38
README.md Normal file
View File

@@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

3
defaults/main.yml Normal file
View File

@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# defaults file for ansible-role-nginx-rtmp

3
handlers/main.yml Normal file
View File

@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# handlers file for ansible-role-nginx-rtmp

35
meta/main.yml Normal file
View File

@@ -0,0 +1,35 @@
#SPDX-License-Identifier: MIT-0
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# 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.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
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.

72
tasks/main.yml Normal file
View File

@@ -0,0 +1,72 @@
#SPDX-License-Identifier: MIT-0
---
# tasks file for ansible-role-nginx-rtmp
- name: Create nginx-rtmp namespace
k8s:
state: present
definition:
apiVersion: v1
kind: Namespace
metadata:
name: nginx-rtmp
- name: Create config map for nginx-rtmp volume
k8s:
state: present
definition:
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx
namespace: nginx-rtmp
data:
nginx.conf: "{{ lookup('template', 'nginx.conf.j2') }}"
- name: Create a Deployment
k8s:
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-rtmp
namespace: nginx-rtmp
spec:
replicas: 1
selector:
matchLabels:
app: nginx-rtmp
template:
metadata:
labels:
app: nginx-rtmp
spec:
containers:
- name: nginx-rtmp
image: ericomeehan/nginx-rtmp
volumeMounts:
- name: config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
ports:
- containerPort: 1935
volumes:
- name: config
configMap:
name: nginx
- name: Expose Deployment as a Service
k8s:
definition:
apiVersion: v1
kind: Service
metadata:
name: nginx-rtmp
namespace: nginx-rtmp
spec:
selector:
app: nginx-rtmp
ports:
- port: 1935
protocol: TCP
name: rtmp
type: LoadBalancer

99
templates/nginx.conf.j2 Normal file
View File

@@ -0,0 +1,99 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
rtmp {
server {
listen 1935;
application live {
live on;
{% for target in nginx_rtmp_push_targets %}
push {{ target }};
{% endfor %}
}
}
}

3
tests/inventory Normal file
View File

@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
localhost

6
tests/test.yml Normal file
View File

@@ -0,0 +1,6 @@
#SPDX-License-Identifier: MIT-0
---
- hosts: localhost
remote_user: root
roles:
- ansible-role-nginx-rtmp

6
vars/main.yml Normal file
View File

@@ -0,0 +1,6 @@
#SPDX-License-Identifier: MIT-0
---
# vars file for ansible-role-nginx-rtmp
nginx_rtmp_push_targets:
- rtmp://owncast.eom.dev/live/stream_key;
- rtmp://a.rtmp.youtube.com/live2/stream_key;