This guide provides a full Ansible playbook to deploy Firefly III with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts.
- name: Deploy Firefly III with Docker
hosts: firefly-iii
become: true
vars:
app_root: /opt/firefly-iii
app_port: 8082
db_password: "{{ vault_firefly_db_password | default('change-me') }}"
root_password: "{{ vault_firefly_root_password | default('change-me') }}"
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create application directory
file:
path: "{{ app_root }}"
state: directory
mode: "0755"
- name: Write Docker Compose file
copy:
dest: "{{ app_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
db:
image: mariadb:11
restart: unless-stopped
environment:
MYSQL_DATABASE: firefly
MYSQL_USER: firefly
MYSQL_PASSWORD: "{{ db_password }}"
MYSQL_ROOT_PASSWORD: "{{ root_password }}"
volumes:
- db_data:/var/lib/mysql
app:
image: fireflyiii/core:latest
restart: unless-stopped
environment:
DB_HOST: db
DB_DATABASE: firefly
DB_USERNAME: firefly
DB_PASSWORD: "{{ db_password }}"
APP_URL: "http://{{ ansible_host }}:{{ app_port }}"
ports:
- "{{ app_port }}:8080"
depends_on:
- db
volumes:
db_data:
- name: Start application stack
command: docker compose up -d
args:
chdir: "{{ app_root }}"
fireflyiii/core:latest.Any questions?
Feel free to contact us. Find all contact information on our contact page.