ansible-nas/roles/silverbullet/tasks/main.yml
David Stephens b7550c9bf5 Add Silverbullet 🗒️
2024-03-10 18:05:02 +00:00

39 lines
1.5 KiB
YAML

---
- name: Start Silverbullet
block:
- name: Create Silverbullet Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ silverbullet_data_directory }}"
- name: silverbullet Docker Container
community.docker.docker_container:
name: "{{ silverbullet_container_name }}"
image: "{{ silverbullet_image_name }}:{{ silverbullet_image_version }}"
pull: true
ports:
- "{{ silverbullet_port }}:3000"
volumes:
- "{{ silverbullet_data_directory }}:/space"
restart_policy: unless-stopped
memory: "{{ silverbullet_memory }}"
env:
SB_USER: "{{ silverbullet_username }}:{{ silverbullet_password }}"
labels:
traefik.enable: "{{ silverbullet_available_externally | string }}"
traefik.http.routers.silverbullet.rule: "Host(`{{ silverbullet_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.silverbullet.tls.certresolver: "letsencrypt"
traefik.http.routers.silverbullet.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.silverbullet.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.silverbullet.loadbalancer.server.port: "3000"
when: silverbullet_enabled is true
- name: Stop silverbullet
block:
- name: Stop silverbullet
community.docker.docker_container:
name: "{{ silverbullet_container_name }}"
state: absent
when: silverbullet_enabled is false