This guide provides a full Ansible playbook to deploy Open Quartermaster with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts. The system uses a modular architecture with separate Core API and Base Station components.
---
- name: Deploy Open Quartermaster
hosts: open-quartermaster
become: true
vars:
app_root: /opt/open-quartermaster
oqm_version: "latest" # Use specific version like "core-base+station-1.14.0" for production
oqm_core_port: 8080
oqm_station_port: 80
oqm_data_dir: "/var/lib/open-quartermaster"
oqm_config_dir: "/etc/open-quartermaster"
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: yes
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
package:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
systemd:
name: docker
state: started
enabled: yes
- name: Add ansible user to docker group
user:
name: "{{ ansible_user | default(ansible_env.USER) }}"
groups: docker
append: yes
- name: Create application directories
file:
path: "{{ item }}"
state: directory
owner: root
group: docker
mode: '0755'
loop:
- "{{ app_root }}"
- "{{ oqm_data_dir }}"
- "{{ oqm_config_dir }}"
- name: Write Docker Compose file
template:
src: docker-compose.yml.j2
dest: "{{ app_root }}/docker-compose.yml"
mode: '0644'
vars:
oqm_core_image: "epicbreakfastproductions/openquartermaster-core:{{ oqm_version }}"
oqm_station_image: "epicbreakfastproductions/openquartermaster-station:{{ oqm_version }}"
oqm_core_port: "{{ oqm_core_port }}"
oqm_station_port: "{{ oqm_station_port }}"
oqm_data_dir: "{{ oqm_data_dir }}"
oqm_config_dir: "{{ oqm_config_dir }}"
- name: Start Open Quartermaster stack
docker_compose:
project_src: "{{ app_root }}"
state: present
pull: yes
- name: Wait for Open Quartermaster to be ready
wait_for:
port: "{{ oqm_station_port }}"
host: "{{ ansible_default_ipv4.address | default('127.0.0.1') }}"
delay: 10
timeout: 120
- name: Print access information
debug:
msg: "Open Quartermaster is available at http://{{ ansible_default_ipv4.address }}:{{ oqm_station_port }}"
Create this template file alongside your playbook:
version: '3.8'
services:
oqm-core:
image: {{ oqm_core_image }}
container_name: oqm-core
restart: unless-stopped
ports:
- "127.0.0.1:{{ oqm_core_port }}:8080"
volumes:
- {{ oqm_data_dir }}/core:/app/data
- {{ oqm_config_dir }}/core:/app/config
environment:
- OQM_DATABASE_URL=jdbc:h2:file:/app/data/oqm
- OQM_DATABASE_DRIVER=org.h2.Driver
- OQM_SERVER_PORT=8080
- OQM_DATA_PATH=/app/data
- OQM_LOG_LEVEL=INFO
networks:
- oqm-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
oqm-station:
image: {{ oqm_station_image }}
container_name: oqm-station
restart: unless-stopped
ports:
- "0.0.0.0:{{ oqm_station_port }}:80"
depends_on:
- oqm-core
volumes:
- {{ oqm_config_dir }}/station:/app/config
environment:
- OQM_CORE_URL=http://oqm-core:8080
- OQM_STATION_PORT=80
networks:
- oqm-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
oqm-network:
driver: bridge
For production environments, consider using PostgreSQL instead of the default H2 database:
oqm-db:
image: postgres:15-alpine
container_name: oqm-postgres
restart: unless-stopped
volumes:
- {{ oqm_data_dir }}/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_DB=oqm
- POSTGRES_USER=oqm_user
- POSTGRES_PASSWORD={{ vault_oqm_db_password }}
networks:
- oqm-network
And update the core service to use PostgreSQL:
oqm-core:
# ... other settings ...
environment:
- OQM_DATABASE_URL=jdbc:postgresql://oqm-db:5432/oqm
- OQM_DATABASE_DRIVER=org.postgresql.Driver
- OQM_DATABASE_USERNAME=oqm_user
- OQM_DATABASE_PASSWORD={{ vault_oqm_db_password }}
# ... other settings ...
depends_on:
- oqm-db
Consider using a reverse proxy like nginx for production:
oqm-proxy:
image: nginx:alpine
container_name: oqm-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- {{ oqm_config_dir }}/ssl:/etc/ssl:ro
depends_on:
- oqm-station
networks:
- oqm-network
"latest" with a specific version like "core-base+station-1.14.0"Any questions?
Feel free to contact us. Find all contact information on our contact page.