commit 906e1abd0694716351de115ec6630e32ac629b8a Author: Julian Rother Date: Sun Jan 26 00:51:04 2025 +0100 Initial commit diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..efc042d --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,15 @@ +icecast2: + location: Earth + admin: icemaster@localhost + hostname: localhost + max_clients: 100 + max_sources: 10 + #source_password: TODO + #relay_password: TODO + admin_user: admin + #admin_password: TODO + listen_sockets: + - port: 8000 + ssl_certificate: /usr/share/icecast2/icecast.pem + http_headers: + Access-Control-Allow-Origin: '*' diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..2ebae2a --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,5 @@ +- name: Restart icecast2 + ansible.builtin.systemd_service: + name: icecast2 + state: restarted + enabled: yes diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..9704dc1 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,19 @@ +- name: Install icecast2 + ansible.builtin.apt: + pkg: + - icecast2 + +- name: Add icecast2 to ssl-cert group + user: + name: icecast2 + groups: ssl-cert + append: yes + +- name: Update config + ansible.builtin.template: + src: icecast.xml.j2 + dest: /etc/icecast2/icecast.xml + owner: root + group: icecast + mode: "0640" + notify: Restart icecast2 diff --git a/templates/icecast.xml.j2 b/templates/icecast.xml.j2 new file mode 100644 index 0000000..3628fc0 --- /dev/null +++ b/templates/icecast.xml.j2 @@ -0,0 +1,235 @@ + + + {{ icecast2.location }} + {{ icecast2.admin }} + + + + + {{ icecast2.max_clients }} + {{ icecast2.max_sources }} + 524288 + 30 + 15 + 10 + + 1 + + 65535 + + + + + {{ icecast2.source_password }} + + {{ icecast2.relay_password }} + + + {{ icecast2.admin_user }} + {{ icecast2.admin_password }} + + + + + + + + + {{ icecast2.hostname }} + + + {% for listen_socket in icecast2.listen_sockets %} + + {% for key, value in listen_socket.items() %} + <{{ key }}>{{ value }} + {% endfor %} + + {% endfor %} + + + + {% for key, value in icecast2.http_headers.items() %} +
+ {% endfor %} + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + /usr/share/icecast2 + + + /var/log/icecast2 + /usr/share/icecast2/web + /usr/share/icecast2/admin + + + + + + + + {{ icecast2.ssl_certificate }} + + + + access.log + error.log + + 3 + 10000 + + + + + + 0 + + +