Skip to content

Commit

Permalink
Merge pull request #115 from anarion80/add_obsidian
Browse files Browse the repository at this point in the history
✨ Add Obsidian
  • Loading branch information
anarion80 authored Apr 15, 2024
2 parents 7678d59 + 72888aa commit a16d9b4
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Nomad](https://www.nomadproject.io/) - A simple and flexible scheduler and software orchestrator
* [NZBget](https://nzbget.net/) - The most efficient usenet downloader
* [Nzbhydra2](https://github.com/theotherp/nzbhydra2) - Usenet meta search
* [Obsidian](https://obsidian.md/) - Obsidian is the private and flexible writing app
* [Octoprint](https://octoprint.org/) - Control and monitor your 3D printer
* [OliveTin](https://github.com/OliveTin/OliveTin) - safe and simple access to predefined shell commands
* [Ombi](https://ombi.io/) - web application that automatically gives your users the ability to request content
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@
tags:
- nzbhydra2

- role: obsidian
tags:
- obsidian

- role: octoprint
tags:
- octoprint
Expand Down
52 changes: 52 additions & 0 deletions roles/obsidian/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
obsidian_enabled: false
obsidian_available_externally: false

# directories
obsidian_data_directory: "{{ docker_home }}/obsidian"

# network
obsidian_port_http: "8132"
obsidian_port_https: "8133"
obsidian_hostname: "obsidian"

# specs
obsidian_memory: 1g

# docker
obsidian_container_name: obsidian
obsidian_image_name: "lscr.io/linuxserver/obsidian"
obsidian_image_version: latest
obsidian_user_id: "1000"
obsidian_group_id: "1000"

# obsidian
obsidian_custom_port: "3000"
obsidian_custom_https_port: "3001"
obsidian_custom_user: "abc"
obsidian_password: "abc"
obsidian_subfolder: "/subfolder/"
obsidian_title: "Obsidian"
obsidian_fm_home: "/config"
obsidian_start_docker: "false"
obsidian_drinode: "/dev/dri/renderD128"
obsidian_lc_all: "en_US.UTF-8"
obsidian_no_decor: "false"
obsidian_no_full: "true"

obsidian_env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ obsidian_user_id }}"
PGID: "{{ obsidian_group_id }}"
CUSTOM_PORT: "{{ obsidian_custom_port }}"
CUSTOM_HTTPS_PORT: "{{ obsidian_custom_https_port }}"
CUSTOM_USER: "{{ obsidian_custom_user }}"
PASSWORD: "{{ obsidian_password }}"
# SUBFOLDER: "{{ obsidian_subfolder }}"
TITLE: "{{ obsidian_title }}"
FM_HOME: "{{ obsidian_fm_home }}"
START_DOCKER: "{{ obsidian_start_docker }}"
# DRINODE: "{{ obsidian_drinode }}"
LC_ALL: "{{ obsidian_lc_all }}"
NO_DECOR: "{{ obsidian_no_decor }}"
NO_FULL: "{{ obsidian_no_full }}"
11 changes: 11 additions & 0 deletions roles/obsidian/docs/obisidian.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Obsidian

Homepage: [https://obsidian.md/](https://obsidian.md/)

Obsidian is a note-taking app that lets you create, link, and organize your notes on your device, with hundreds of plugins and themes to customize your workflow. You can also publish your notes online, access them offline, and sync them securely with end-to-end encryption.

## Usage

Set `obsidian_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.

Obsidian web interface can be found at [http://ansible_nas_host_or_ip:8132](http://ansible_nas_host_or_ip:8132).
6 changes: 6 additions & 0 deletions roles/obsidian/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
obsidian_enabled: true
10 changes: 10 additions & 0 deletions roles/obsidian/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"
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
obsidian_enabled: false
19 changes: 19 additions & 0 deletions roles/obsidian/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Get obsidian container state
community.docker.docker_container:
name: "{{ obsidian_container_name }}"
register: result

- name: Check if obsidian containers are running
ansible.builtin.assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
19 changes: 19 additions & 0 deletions roles/obsidian/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove obsidian
community.docker.docker_container:
name: "{{ obsidian_container_name }}"
state: absent
register: result

- name: Check if obsidian is stopped
ansible.builtin.assert:
that:
- not result.changed
1 change: 1 addition & 0 deletions roles/obsidian/requirements.yml
42 changes: 42 additions & 0 deletions roles/obsidian/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
- name: Start Obsidian
block:
- name: Create obsidian Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ obsidian_data_directory }}"

- name: Create Obsidian Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ obsidian_container_name }}"
image: "{{ obsidian_image_name }}:{{ obsidian_image_version }}"
pull: true
volumes:
- "{{ obsidian_data_directory }}/config:/config:rw"
ports:
- "{{ obsidian_port_http }}:3000"
- "{{ obsidian_port_https }}:3001"
env: "{{ obsidian_env }}"
restart_policy: unless-stopped
memory: "{{ obsidian_memory }}"
security_opts:
- seccomp:unconfined
labels:
traefik.enable: "{{ obsidian_available_externally | string }}"
traefik.http.routers.obsidian.rule: "Host(`{{ obsidian_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.obsidian.tls.certresolver: "letsencrypt"
traefik.http.routers.obsidian.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.obsidian.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.obsidian.loadbalancer.server.port: "3000"
when: obsidian_enabled is true

- name: Stop Obsidian
block:
- name: Stop Obsidian
community.docker.docker_container:
name: "{{ obsidian_container_name }}"
state: absent
when: obsidian_enabled is false
13 changes: 13 additions & 0 deletions website/docs/applications/content-management/obsidian.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Obsidian"
description: "Obsidian is the private and flexible writing app that adapts to the way you think."
---
Homepage: [https://obsidian.md/](https://obsidian.md/)

Obsidian is a note-taking app that lets you create, link, and organize your notes on your device, with hundreds of plugins and themes to customize your workflow. You can also publish your notes online, access them offline, and sync them securely with end-to-end encryption.

## Usage

Set `obsidian_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.

Obsidian web interface can be found at [http://ansible_nas_host_or_ip:8132](http://ansible_nas_host_or_ip:8132).

0 comments on commit a16d9b4

Please sign in to comment.