This guide deploys a Buildbot master container with persistent data volume using Ansible-managed Docker Compose.
/opt/buildbot directorydocker-compose.yml for Buildbot master- name: Deploy Buildbot master with Docker
hosts: buildbot
become: true
vars:
buildbot_root: /opt/buildbot
tasks:
- name: Install Docker on Debian family
ansible.builtin.apt:
update_cache: true
name:
- docker.io
- docker-compose-plugin
state: present
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
ansible.builtin.dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable Docker service
ansible.builtin.systemd:
name: docker
enabled: true
state: started
- name: Create Buildbot root directory
ansible.builtin.file:
path: "{{ buildbot_root }}"
state: directory
mode: "0755"
- name: Write Docker Compose file
ansible.builtin.copy:
dest: "{{ buildbot_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
master:
image: buildbot/buildbot-master:latest
container_name: buildbot-master
restart: unless-stopped
ports:
- "8010:8010"
volumes:
- buildbot_master:/var/lib/buildbot
volumes:
buildbot_master:
- name: Start Buildbot stack
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ buildbot_root }}"
ansible-playbook -i inventory.ini buildbot-docker-install.yml