This guide provides a full Ansible playbook to deploy Odoo Accounting with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts.
- name: Deploy Odoo Accounting with Docker
hosts: odoo-accounting
become: true
vars:
app_root: /opt/odoo
app_port: 8069
db_password: "{{ vault_odoo_db_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: postgres:16
restart: unless-stopped
environment:
POSTGRES_DB: odoo
POSTGRES_USER: odoo
POSTGRES_PASSWORD: {{ db_password }}
volumes:
- db_data:/var/lib/postgresql/data
app:
image: odoo:latest
restart: unless-stopped
environment:
HOST: db
USER: odoo
PASSWORD: {{ db_password }}
ports:
- "{{ app_port }}:8069"
depends_on:
- db
volumes:
- odoo_data:/var/lib/odoo
volumes:
db_data:
odoo_data:
- name: Start application stack
command: docker compose up -d
args:
chdir: "{{ app_root }}"
odoo:latest.Any questions?
Feel free to contact us. Find all contact information on our contact page.