forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -646,6 +646,10 @@ | |
tags: | ||
- silverbullet | ||
|
||
- role: siyuan | ||
tags: | ||
- siyuan | ||
|
||
- role: snipeit | ||
tags: | ||
- snipeit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
siyuan_enabled: false | ||
siyuan_available_externally: false | ||
|
||
# directories | ||
siyuan_data_directory: "{{ docker_home }}/siyuan" | ||
|
||
# network | ||
siyuan_port: "8134" | ||
siyuan_hostname: "siyuan" | ||
|
||
# specs | ||
siyuan_memory: 1g | ||
|
||
# docker | ||
siyuan_container_name: siyuan | ||
siyuan_image_name: "b3log/siyuan" | ||
siyuan_image_version: latest | ||
siyuan_user_id: "1000" | ||
siyuan_group_id: "1000" | ||
|
||
# siyuan | ||
siyuan_access_auth_code: "change_me" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Siyuan | ||
|
||
Homepage: [https://github.com/siyuan-note/siyuan](https://github.com/siyuan-note/siyuan) | ||
|
||
SiYuan is a privacy-first personal knowledge management system, support fine-grained block-level reference and Markdown WYSIWYG. | ||
|
||
## Usage | ||
|
||
Set `siyuan_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
Siyuan web interface can be found at [http://ansible_nas_host_or_ip:8134](http://ansible_nas_host_or_ip:8134). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
siyuan_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
siyuan_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 siyuan container state | ||
community.docker.docker_container: | ||
name: "{{ siyuan_container_name }}" | ||
register: result | ||
|
||
- name: Check if siyuan containers are running | ||
ansible.builtin.assert: | ||
that: | ||
- result.container['State']['Status'] == "running" | ||
- result.container['State']['Restarting'] == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 siyuan | ||
community.docker.docker_container: | ||
name: "{{ siyuan_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check if siyuan is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
- name: Start Siyuan | ||
block: | ||
- name: Create Siyuan Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: "{{ siyuan_user_id }}" | ||
group: "{{ siyuan_group_id }}" | ||
with_items: | ||
- "{{ siyuan_data_directory }}" | ||
- "{{ siyuan_data_directory }}/workspace" | ||
|
||
- name: Create Siyuan Docker Container | ||
community.docker.docker_container: | ||
container_default_behavior: no_defaults | ||
name: "{{ siyuan_container_name }}" | ||
image: "{{ siyuan_image_name }}:{{ siyuan_image_version }}" | ||
pull: true | ||
command: ['--workspace=/siyuan/workspace/', '--accessAuthCode={{ siyuan_access_auth_code }}'] | ||
user: "{{ siyuan_user_id | quote }}:{{ siyuan_group_id | quote }}" | ||
volumes: | ||
- "{{ siyuan_data_directory }}/workspace:/siyuan/workspace/" | ||
ports: | ||
- "{{ siyuan_port }}:6806" | ||
env: | ||
TZ: "{{ ansible_nas_timezone }}" | ||
PUID: "{{ siyuan_user_id | quote }}" | ||
PGID: "{{ siyuan_group_id | quote }}" | ||
DOCKER_ENABLE_SECURITY: "false" | ||
restart_policy: unless-stopped | ||
memory: "{{ siyuan_memory }}" | ||
labels: | ||
traefik.enable: "{{ siyuan_available_externally | string }}" | ||
traefik.http.routers.siyuan.rule: "Host(`{{ siyuan_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.siyuan.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.siyuan.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.siyuan.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.siyuan.loadbalancer.server.port: "6806" | ||
when: siyuan_enabled is true | ||
|
||
- name: Stop Siyuan | ||
block: | ||
- name: Stop Stirling-PDF | ||
community.docker.docker_container: | ||
name: "{{ siyuan_container_name }}" | ||
state: absent | ||
when: siyuan_enabled is false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "Siyuan" | ||
description: "A privacy-first, self-hosted, fully open source personal knowledge management software" | ||
--- | ||
|
||
Homepage: [https://github.com/siyuan-note/siyuan](https://github.com/siyuan-note/siyuan) | ||
|
||
SiYuan is a privacy-first personal knowledge management system, support fine-grained block-level reference and Markdown WYSIWYG. | ||
|
||
## Usage | ||
|
||
Set `siyuan_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
Siyuan web interface can be found at [http://ansible_nas_host_or_ip:8134](http://ansible_nas_host_or_ip:8134). |