summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/gonic/tasks/main.yml53
-rw-r--r--roles/gonic/templates/openrc/gonic31
-rw-r--r--roles/jamdog/tasks/main.yml (renamed from roles/scag/tasks/main.yml)74
-rw-r--r--roles/jamdog/templates/header.html10
-rw-r--r--roles/jamdog/templates/jamdog.toml (renamed from roles/scag/templates/scag.toml)0
-rw-r--r--roles/jamdog/templates/nginx/feed.conf (renamed from roles/scag/templates/nginx/feed.conf)0
-rw-r--r--roles/mox/templates/mox.conf1
-rw-r--r--roles/scag/templates/header.html30
8 files changed, 131 insertions, 68 deletions
diff --git a/roles/gonic/tasks/main.yml b/roles/gonic/tasks/main.yml
new file mode 100644
index 0000000..10832c0
--- /dev/null
+++ b/roles/gonic/tasks/main.yml
@@ -0,0 +1,53 @@
+- name: Install gonic
+ community.general.apk:
+ name: gonic
+
+- name: Create music folder
+ ansible.builtin.file:
+ path: /media/seagate/music
+ state: directory
+
+- name: Create podcasts folder
+ ansible.builtin.file:
+ path: /media/seagate/podcasts
+ state: directory
+
+- name: Create playlists folder
+ ansible.builtin.file:
+ path: /media/seagate/playlists
+ state: directory
+
+- name: Create cache folder
+ ansible.builtin.file:
+ path: /var/gonic/cache
+ state: directory
+
+- name: Symlink music folder to /srv
+ ansible.builtin.file:
+ src: /media/seagate/music
+ dest: /srv/music
+ state: link
+
+- name: Symlink podcasts folder to /srv
+ ansible.builtin.file:
+ src: /media/seagate/podcasts
+ dest: /srv/podcasts
+ state: link
+
+- name: Symlink playlists folder to /srv
+ ansible.builtin.file:
+ src: /media/seagate/playlists
+ dest: /srv/playlists
+ state: link
+
+- name: Add gonic service
+ ansible.builtin.template:
+ src: openrc/gonic
+ dest: /etc/init.d/gonic
+ mode: "755"
+
+- name: Enable and restart gonic service
+ ansible.builtin.service:
+ name: gonic
+ enabled: true
+ state: restarted
diff --git a/roles/gonic/templates/openrc/gonic b/roles/gonic/templates/openrc/gonic
new file mode 100644
index 0000000..fa380b3
--- /dev/null
+++ b/roles/gonic/templates/openrc/gonic
@@ -0,0 +1,31 @@
+#!/sbin/openrc-run
+
+description="Run gonic"
+
+start()
+{
+ ebegin "Starting gonic"
+ start-stop-daemon --start \
+ --exec /usr/bin/gonic \
+ --background \
+ --chdir ~mox \
+ --stdout /var/log/gonic.log \
+ --stderr /var/log/gonic.log \
+ --make-pidfile \
+ --pidfile /run/gonic.pid \
+ -- -music-path /srv/music \
+ -playlists-path /srv/playlists \
+ -podcast-path /srv/podcasts \
+ -cache-path /var/gonic/cache \
+ -listen-addr "0.0.0.0:{{ services.gonic.port }}"
+ eend $?
+}
+
+stop()
+{
+ ebegin "Stopping gonic"
+ start-stop-daemon --stop \
+ --exec /usr/bingonicmox \
+ --pidfile /run/gonic.pid
+ eend $?
+}
diff --git a/roles/scag/tasks/main.yml b/roles/jamdog/tasks/main.yml
index ca26c3e..81626e0 100644
--- a/roles/scag/tasks/main.yml
+++ b/roles/jamdog/tasks/main.yml
@@ -1,28 +1,28 @@
-- name: Install scag by pre-compiling the binary
- when: ( not ( scag_install_method is defined ) ) or scag_install_method == "precompile"
+- name: Install jamdog by pre-compiling the binary
+ when: ( not ( jamdog_install_method is defined ) ) or jamdog_install_method == "precompile"
block:
- - name: Fetch scag source code
+ - name: Fetch jamdog source code
delegate_to: 127.0.0.1
become: false
ansible.builtin.git:
- repo: https://git.joeac.net/scag.git
- dest: /tmp/scag
+ repo: https://git.joeac.net/jamdog.git
+ dest: /tmp/jamdog
depth: 1
- - name: Cross-compile scag
+ - name: Cross-compile jamdog
delegate_to: 127.0.0.1
become: false
ansible.builtin.shell:
cmd: cross build --release --target {{ rust_target }}
- chdir: /tmp/scag
+ chdir: /tmp/jamdog
changed_when: "'Compiling' in _task.result.stderr"
- - name: Install scag binary
+ - name: Install jamdog binary
ansible.builtin.copy:
- src: /tmp/scag/target/{{ rust_target }}/release/scag
- dest: /usr/bin/scag
+ src: /tmp/jamdog/target/{{ rust_target }}/release/jamdog
+ dest: /usr/bin/jamdog
mode: +x
-- name: Install or update scag using rustup
- when: scag_install_method == "rustup"
+- name: Install or update jamdog using rustup
+ when: jamdog_install_method == "rustup"
block:
- name: Install Rust toolchain using installation script
ansible.builtin.shell:
@@ -31,41 +31,41 @@
- name: Update Rust toolchain with rustup
ansible.builtin.shell: rustup update
changed_when: "'updated' in _task.result.stdout"
- - name: Install or update scag using cargo
+ - name: Install or update jamdog using cargo
ansible.builtin.shell:
- cmd: cargo install --git git://git.joeac.net/scag.git
+ cmd: cargo install --git git://git.joeac.net/jamdog.git
changed_when: "'Installed' in _task.result.stdout or 'Replaced' in _task.result.stdout"
- - name: Install daily crontab to update scag using cargo
+ - name: Install daily crontab to update jamdog using cargo
ansible.builtin.cron:
special_time: daily
- name: Update scag
- job: cargo install --git git://git.joeac.net/scag.git
+ name: Update jamdog
+ job: cargo install --git git://git.joeac.net/jamdog.git
-- name: Install scag using cargo provided by APK
- when: scag_install_method == "cargo"
+- name: Install jamdog using cargo provided by APK
+ when: jamdog_install_method == "cargo"
block:
- name: Install cargo using APK
community.general.apk:
name: cargo
- - name: Install or update scag using cargo
+ - name: Install or update jamdog using cargo
ansible.builtin.shell:
- cmd: cargo install --git git://git.joeac.net/scag.git
+ cmd: cargo install --git git://git.joeac.net/jamdog.git
changed_when: "'Installed' in _task.result.stdout or 'Replaced' in _task.result.stdout"
- - name: Install daily crontab to update scag using cargo
+ - name: Install daily crontab to update jamdog using cargo
ansible.builtin.cron:
special_time: daily
- name: Update scag
- job: cargo install --git git://git.joeac.net/scag.git
+ name: Update jamdog
+ job: cargo install --git git://git.joeac.net/jamdog.git
-- name: Create scag configuration directory
+- name: Create jamdog configuration directory
ansible.builtin.file:
- path: /etc/scag
+ path: /etc/jamdog
state: directory
-- name: Configure scag
+- name: Configure jamdog
ansible.builtin.template:
- src: scag.toml
- dest: /etc/scag/config.toml
+ src: jamdog.toml
+ dest: /etc/jamdog/config.toml
- name: Configure HTML feed head
ansible.builtin.shell:
@@ -86,10 +86,10 @@
dest: "{{ src_dir }}/subscriptions"
depth: 1
-- name: Symlink subscriptions into scag configuration directory
+- name: Symlink subscriptions into jamdog configuration directory
ansible.builtin.file:
src: "{{ src_dir }}/subscriptions/subscriptions.txt"
- dest: /etc/scag/subscriptions.txt
+ dest: /etc/jamdog/subscriptions.txt
state: link
- name: Create directory for RSS file
@@ -99,9 +99,9 @@
owner: nginx
group: nginx
-- name: Use scag to generate RSS file
+- name: Use jamdog to generate RSS file
ansible.builtin.shell:
- cmd: scag
+ cmd: jamdog
creates: "{{ http_files_dir }}/feed/{{ feed_rss_path }}"
- name: Install nginx location config
@@ -116,10 +116,8 @@
name: nginx
state: restarted
-- name: Install hourly crontab to update subscriptions and run scag
+- name: Install hourly crontab to update subscriptions and run jamdog
ansible.builtin.cron:
special_time: daily
- name: Run scag
- job: >-
- git -C "{{ src_dir }}/subscriptions" pull;
- scag
+ name: Run jamdog
+ job: git -C "{{ src_dir }}/subscriptions" pull; jamdog
diff --git a/roles/jamdog/templates/header.html b/roles/jamdog/templates/header.html
new file mode 100644
index 0000000..1e6ee30
--- /dev/null
+++ b/roles/jamdog/templates/header.html
@@ -0,0 +1,10 @@
+<nav>
+ <ul>
+ <li>
+ <a href=/>Home</a>
+ </li>
+ <li>
+ <a href=/{{ feed_rss_path }}>RSS</a>
+ </li>
+ </ul>
+</nav>
diff --git a/roles/scag/templates/scag.toml b/roles/jamdog/templates/jamdog.toml
index 9eafa6c..9eafa6c 100644
--- a/roles/scag/templates/scag.toml
+++ b/roles/jamdog/templates/jamdog.toml
diff --git a/roles/scag/templates/nginx/feed.conf b/roles/jamdog/templates/nginx/feed.conf
index 6f650ba..6f650ba 100644
--- a/roles/scag/templates/nginx/feed.conf
+++ b/roles/jamdog/templates/nginx/feed.conf
diff --git a/roles/mox/templates/mox.conf b/roles/mox/templates/mox.conf
index 8cafc25..8d089ff 100644
--- a/roles/mox/templates/mox.conf
+++ b/roles/mox/templates/mox.conf
@@ -40,6 +40,7 @@ Listeners:
WebserverHTTPS:
Enabled: true
TLS:
+ MinVersion: TLSv1.3
KeyCerts:
{% for subdomain in ( subdomains | map(attribute='name') ) %}
-
diff --git a/roles/scag/templates/header.html b/roles/scag/templates/header.html
deleted file mode 100644
index 20ea0f1..0000000
--- a/roles/scag/templates/header.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<nav>
- <ul>
- <li>
- <a href=/>Home</a>
- </li>
- <li>
- <a href=/{{ feed_rss_path }}>RSS</a>
- </li>
- </ul>
-</nav>
-
-<script type=module>
-function makeDetailsToggler(details) {
- return () => {
- if (details.hasAttribute('open')) {
- details.removeAttribute('open');
- } else {
- details.setAttribute('open', '');
- }
- };
-}
-
-for (const entry of document.querySelectorAll('.h-entry')) {
- const details = entry.querySelector('details');
- const summary = entry.querySelector('summary');
- const toggleDetails = makeDetailsToggler(entry.querySelector('details'));
- entry.addEventListener('click', toggleDetails);
- summary.addEventListener('click', toggleDetails);
-}
-</script>