mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-26 02:05:05 +00:00
Start and stop firefly
This commit is contained in:
parent
90a4eacad6
commit
0bc58c39bc
3 changed files with 76 additions and 57 deletions
1
nas.yml
1
nas.yml
|
@ -108,7 +108,6 @@
|
|||
- role: firefly
|
||||
tags:
|
||||
- firefly
|
||||
when: (firefly_enabled | default(False))
|
||||
|
||||
- role: freshrss
|
||||
tags:
|
||||
|
|
|
@ -13,3 +13,7 @@ firefly_port: "8066"
|
|||
# specs
|
||||
firefly_memory: "1g"
|
||||
firefly_mysql_memory: "1g"
|
||||
|
||||
# docker
|
||||
firefly_container_name: firefly
|
||||
firefly_mysql_container_name: firefly-mysql
|
||||
|
|
|
@ -1,60 +1,76 @@
|
|||
---
|
||||
- name: Create Firefly III Directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ firefly_data_directory }}/postgresql"
|
||||
- "{{ firefly_data_directory }}/mysql"
|
||||
- "{{ firefly_data_directory }}/upload"
|
||||
- "{{ firefly_data_directory }}/export"
|
||||
- name: Start Firefly
|
||||
block:
|
||||
- name: Create Firefly III Directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ firefly_data_directory }}/postgresql"
|
||||
- "{{ firefly_data_directory }}/mysql"
|
||||
- "{{ firefly_data_directory }}/upload"
|
||||
- "{{ firefly_data_directory }}/export"
|
||||
|
||||
- name: Create MySQL container for Firefly
|
||||
docker_container:
|
||||
name: firefly-mysql
|
||||
image: mysql:5.7
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ firefly_data_directory }}/mysql:/var/lib/mysql:rw"
|
||||
env:
|
||||
MYSQL_DATABASE: "firefly"
|
||||
MYSQL_USER: "firefly"
|
||||
MYSQL_PASSWORD: "firefly"
|
||||
MYSQL_ROOT_PASSWORD: "firefly"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ firefly_mysql_memory }}"
|
||||
- name: Create MySQL container for Firefly
|
||||
docker_container:
|
||||
name: "{{ firefly_mysql_container_name }}"
|
||||
image: mysql:5.7
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ firefly_data_directory }}/mysql:/var/lib/mysql:rw"
|
||||
env:
|
||||
MYSQL_DATABASE: "firefly"
|
||||
MYSQL_USER: "firefly"
|
||||
MYSQL_PASSWORD: "firefly"
|
||||
MYSQL_ROOT_PASSWORD: "firefly"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ firefly_mysql_memory }}"
|
||||
|
||||
- name: Wait for MySQL to init
|
||||
pause:
|
||||
seconds: 30
|
||||
- name: Wait for MySQL to init
|
||||
pause:
|
||||
seconds: 30
|
||||
|
||||
- name: Create Firefly III container
|
||||
docker_container:
|
||||
name: firefly
|
||||
image: fireflyiii/core:latest
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ firefly_data_directory }}/export:/var/www/firefly-iii/storage/export:rw"
|
||||
- "{{ firefly_data_directory }}/upload:/var/www/firefly-iii/storage/upload:rw"
|
||||
links:
|
||||
- firefly-mysql:db
|
||||
ports:
|
||||
- "{{ firefly_port }}:8080"
|
||||
env:
|
||||
APP_ENV: "local"
|
||||
APP_KEY: "S0m3R@nd0mString0f32Ch@rsEx@ct1y"
|
||||
DB_CONNECTION: "mysql"
|
||||
DB_HOST: "db"
|
||||
DB_DATABASE: "firefly"
|
||||
DB_USERNAME: "firefly"
|
||||
DB_PASSWORD: "firefly"
|
||||
TZ: "{{ ansible_nas_timezone }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ firefly_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ firefly_available_externally | string }}"
|
||||
traefik.http.routers.firefly.rule: "Host(`{{ firefly_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.firefly.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.firefly.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.firefly.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.firefly.loadbalancer.server.port: "8080"
|
||||
- name: Create Firefly III container
|
||||
docker_container:
|
||||
name: "{{ firefly_container_name }}"
|
||||
image: fireflyiii/core:latest
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ firefly_data_directory }}/export:/var/www/firefly-iii/storage/export:rw"
|
||||
- "{{ firefly_data_directory }}/upload:/var/www/firefly-iii/storage/upload:rw"
|
||||
links:
|
||||
- firefly-mysql:db
|
||||
ports:
|
||||
- "{{ firefly_port }}:8080"
|
||||
env:
|
||||
APP_ENV: "local"
|
||||
APP_KEY: "S0m3R@nd0mString0f32Ch@rsEx@ct1y"
|
||||
DB_CONNECTION: "mysql"
|
||||
DB_HOST: "db"
|
||||
DB_DATABASE: "firefly"
|
||||
DB_USERNAME: "firefly"
|
||||
DB_PASSWORD: "firefly"
|
||||
TZ: "{{ ansible_nas_timezone }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ firefly_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ firefly_available_externally | string }}"
|
||||
traefik.http.routers.firefly.rule: "Host(`{{ firefly_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.firefly.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.firefly.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.firefly.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.firefly.loadbalancer.server.port: "8080"
|
||||
when: firefly_enabled is true
|
||||
|
||||
- name: Stop Firefly
|
||||
block:
|
||||
- name: Stop Firefly
|
||||
docker_container:
|
||||
name: "{{ firefly_container_name }}"
|
||||
state: absent
|
||||
|
||||
- name: Stop Firefly MySQL
|
||||
docker_container:
|
||||
name: "{{ firefly_mysql_container_name }}"
|
||||
state: absent
|
||||
when: firefly_enabled is false
|
||||
|
|
Loading…
Reference in a new issue