Skip to content

Commit

Permalink
Merge branch 'main' into audiobookshelf-add
Browse files Browse the repository at this point in the history
  • Loading branch information
tsjordan-eng authored Dec 2, 2024
2 parents 73ea064 + 1aec019 commit 98bd1cf
Show file tree
Hide file tree
Showing 22 changed files with 653 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ If you have a spare domain name you can configure applications to be accessible
## Available Applications

* [Airsonic](https://airsonic.github.io/) - catalog and stream music
* [Apcupsd](http://www.apcupsd.org/) - A daemon for controlling APC UPSes
* [Audiobookshelf](https://www.audiobookshelf.org/) - Self-hosted audiobook and podcast server
* [Bazarr](https://github.com/morpheus65535/bazarr) - companion to Radarr and Sonarr for downloading subtitles
* [Bitwarden](https://github.com/dani-garcia/vaultwarden) - Password Manger (Technically Vaultwarden, a lightweight implementation in Rust)
Expand Down Expand Up @@ -52,6 +53,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Heimdall](https://heimdall.site/) - Home server dashboard
* [Home Assistant](https://www.home-assistant.io) - Open source home automation
* [Homebridge](https://github.com/nfarina/homebridge) - Emulate the iOS HomeKit API
* [iSpy Agent DVR](https://www.ispyconnect.com/) - iSpy - Agent DVR is a video surveillance software
* [Jackett](https://github.com/Jackett/Jackett) - API Support for your favorite torrent trackers
* [Jellyfin](https://jellyfin.github.io) - The Free Software Media System
* [Joomla](https://www.joomla.org/) - Open source content management system
Expand Down
8 changes: 8 additions & 0 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ samba_shares:
browseable: yes
path: "{{ code_root }}"

- name: recordings
comment: "Recordings"
guest_ok: yes
public: yes
writable: yes
browseable: yes
path: "{{ recordings_root }}"

###
### NFS
###
Expand Down
8 changes: 8 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
tags:
- airsonic

- role: apcupsd
tags:
- apcupsd

- role: audiobookshelf
tags:
- audiobookshelf
Expand Down Expand Up @@ -193,6 +197,10 @@
tags:
- homepage

- role: ispyagentdvr
tags:
- ispyagentdvr

- role: jackett
tags:
- jackett
Expand Down
24 changes: 24 additions & 0 deletions roles/apcupsd/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apcupsd_enabled: false

# directories
apcupsd_data_directory: "{{ docker_home }}/apcupsd"

# network
apcupsd_port: "3551"

# specs
apcupsd_memory: 1g

# docker
apcupsd_container_name: apcupsd

# ups config
apcupsd_onbatterydelay: 6
apcupsd_batterylevel: 5
apcupsd_minutes: 5
apcupsd_timeout: 0
apcupsd_annoy: 300
apcupsd_annoydelay: 60
apcupsd_nologon: "disable"
apcupsd_killdelay: 0
6 changes: 6 additions & 0 deletions roles/apcupsd/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
apcupsd_enabled: true
10 changes: 10 additions & 0 deletions roles/apcupsd/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
apcupsd_enabled: false
18 changes: 18 additions & 0 deletions roles/apcupsd/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- include_vars:
file: ../../defaults/main.yml

- name: Get container state
docker_container_info:
name: "{{ apcupsd_container_name }}"
register: result

- name: Check Apcupsd is running
assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
18 changes: 18 additions & 0 deletions roles/apcupsd/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove Apcupsd
docker_container:
name: "{{ apcupsd_container_name }}"
state: absent
register: result

- name: Check Apcupsd is stopped
assert:
that:
- not result.changed
48 changes: 48 additions & 0 deletions roles/apcupsd/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---

- name: Start Apcupsd
block:
- name: Create Apcupsd Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ apcupsd_data_directory }}"

- name: "Check if Apcupsd config exists"
ansible.builtin.stat:
path: "{{ apcupsd_data_directory }}/apcupsd.conf"
register: apcupsd_config_path

- name: Template Apcupsd config
ansible.builtin.template:
src: apcupsd.conf
dest: "{{ apcupsd_data_directory }}/apcupsd.conf"
when: not apcupsd_config_path.stat.exists

- name: Apcupsd Docker Container
community.docker.docker_container:
name: "{{ apcupsd_container_name }}"
image: gregewing/apcupsd
pull: true
privileged: true
volumes:
- "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket"
- "{{ apcupsd_data_directory }}/apcupsd.conf:/etc/apcupsd/apcupsd.conf"
ports:
- "{{ apcupsd_port }}:3551"
devices:
- "{{ apcupsd_device }}:{{ apcupsd_device }}"
env:
TZ: "{{ ansible_nas_timezone }}"
restart_policy: unless-stopped
memory: "{{ apcupsd_memory }}"
when: apcupsd_enabled is true

- name: Stop Apcupsd
block:
- name: Stop Apcupsd
community.docker.docker_container:
name: "{{ apcupsd_container_name }}"
state: absent
when: apcupsd_enabled is false
Loading

0 comments on commit 98bd1cf

Please sign in to comment.