From 372d53963c0be306d8e03028a2fae657633e930b Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Thu, 22 Oct 2026 23:30:23 +0300 Subject: feat: add umurmur --- roles/cosmos/tasks/main.yml | 27 ++++++++++++ roles/umurmur/handlers/main.yml | 5 +++ roles/umurmur/tasks/main.yml | 36 ++++++++++++++++ roles/umurmur/templates/umurmurd.conf.j2 | 73 ++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 roles/umurmur/handlers/main.yml create mode 100644 roles/umurmur/tasks/main.yml create mode 100644 roles/umurmur/templates/umurmurd.conf.j2 diff --git a/roles/cosmos/tasks/main.yml b/roles/cosmos/tasks/main.yml index a50205c..dd59094 100644 --- a/roles/cosmos/tasks/main.yml +++ b/roles/cosmos/tasks/main.yml @@ -30,5 +30,32 @@ root_desc: "Here you can find all our git repositories" scan_path: "/var/lib/git/repositories/" + - name: Provision community umurmur instance + ansible.builtin.include_role: + name: umurmur + vars: + certificate: "/etc/ssl/cosmos.party.fullchain.pem" + private_key: "/etc/ssl/private/cosmos.party.key" + welcometext: "Добро пожаловать!" + channels: + - name: "Root" + description: "The Root of all channels" + noenter: true + - name: "Lobby" + parent: "Root" + description: "Lobby channel" + - name: "Red team" + parent: "Lobby" + description: "The Red team channel" + - name: "Blue team" + parent: "Lobby" + description: "The Blue team channel" + default_channel: "Lobby" + channel_links: + - source: "Lobby" + destination: "Red team" + - source: "Lobby" + destination: "Blue team" + tags: - cosmos diff --git a/roles/umurmur/handlers/main.yml b/roles/umurmur/handlers/main.yml new file mode 100644 index 0000000..a21be7f --- /dev/null +++ b/roles/umurmur/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart uMurmur + ansible.builtin.service: + name: umurmur + state: restarted diff --git a/roles/umurmur/tasks/main.yml b/roles/umurmur/tasks/main.yml new file mode 100644 index 0000000..4f08c0c --- /dev/null +++ b/roles/umurmur/tasks/main.yml @@ -0,0 +1,36 @@ +--- +- block: + - name: Install uMurmur package + community.general.apk: + name: + - umurmur + - umurmur-openrc + state: present + + - name: Create uMurmur config directory + ansible.builtin.file: + path: /etc/umurmur + state: directory + owner: root + group: root + mode: '0755' + + - name: Deploy uMurmur configuration template + ansible.builtin.template: + src: umurmurd.conf.j2 + dest: /etc/umurmur/umurmurd.conf + owner: root + group: root + mode: '0440' + validate: /usr/bin/umurmurd -t -c %s + notify: Restart uMurmur + + - name: Enable and start uMurmur service + ansible.builtin.service: + name: umurmur + enabled: true + state: started + runlevel: default + + tags: + - umurmur diff --git a/roles/umurmur/templates/umurmurd.conf.j2 b/roles/umurmur/templates/umurmurd.conf.j2 new file mode 100644 index 0000000..9e8f8c6 --- /dev/null +++ b/roles/umurmur/templates/umurmurd.conf.j2 @@ -0,0 +1,73 @@ +# {{ ansible_managed }} +{# + This configuration is based on the official example + configuration. More information can be found at + http://code.google.com/p/umurmur/wiki/Configuring02x +#} + +max_bandwidth = {{ max_bandwidth | default(48000) | int }}; +welcometext = "{{ welcometext | default('Welcome to uMurmur!') }}"; +certificate = "{{ certificate | default('') }}"; +private_key = "{{ private_key | default('') }}"; +password = "{{ password | default('') }}"; +admin_password = "{{ admin_password | default('') }}"; +max_users = {{ max_users | default(10) | int }}; + +bindport = {{ bindport | default(64738) | int }}; +bindaddr = "{{ bindaddr | default('0.0.0.0') }}"; + +{# + Specify this for privilege dropping. If username is specified but + not the groupname, the user's login group is used. +#} +username = "{{ username | default('umurmur') }}"; +groupname = "{{ groupname | default('umurmur') }}"; + +logfile = "{{ logfile | default('/var/log/umurmurd.log') }}"; + +enable_ban = {{ enable_ban | default(false) | lower }}; +sync_banfile = {{ sync_banfile | default(false) | lower }}; +ban_length = {{ ban_length | default(0) | int }}; +banfile = "{{ banfile | default('') }}"; + +channels = ( +{% for channel in channels %} + { + name = "{{ channel.name }}"; + parent = "{{ channel.parent | default('') }}"; +{% if channel.noenter is defined %} + noenter = {{ channel.noenter | lower }}; +{% endif %} +{% if channel.password is defined and channel.password %} + password = "{{ channel.password }}"; +{% endif %} +{% if channel.description is defined and channel.description %} + description = "{{ channel.description }}"; +{% endif %} +{% if channel.silent is defined %} + silent = {{ channel.silent | lower }}; +{% endif %} +{% if channel.position is defined %} + position = {{ channel.position | int }}; +{% endif %} + }{%- if not loop.last -%},{%- endif %} + +{% endfor %} +); + +{% if channel_links is defined and channel_links %} +channel_links = ( +{% for link in channel_links %} + { + source = "{{ link.source }}"; + destination = "{{ link.destination }}"; + }{%- if not loop.last -%}, +{%- endif %} + +{% endfor %} +); +{% endif %} + +{% if default_channel is defined and default_channel %} +default_channel = "{{ default_channel }}"; +{% endif %} -- cgit v1.3.1