Files
brainwave/ansible/deploy.yml
T

38 lines
1.3 KiB
YAML

---
- name: Deploy Brainwave ARM to OrangePi
hosts: orangepi
gather_facts: false
# Requires: SSH user must be in the 'docker' group on the OrangePi.
# If not, set 'become: true' on the Load Docker image and Start container tasks.
vars:
deploy_dir: "/home/{{ ansible_user }}/brainwave"
tasks:
- name: Ensure deploy directory exists
ansible.builtin.file:
path: "{{ deploy_dir }}"
state: directory
mode: "0755"
- name: Copy ARM tarball
ansible.builtin.copy:
src: "{{ artifact_path }}/brainwave-arm64.tar.gz"
dest: "{{ deploy_dir }}/brainwave-arm64.tar.gz"
- name: Copy ARM docker-compose file
ansible.builtin.copy:
src: "{{ artifact_path }}/docker-compose.arm64.yml"
dest: "{{ deploy_dir }}/docker-compose.yml"
- name: Load Docker image
ansible.builtin.command: docker load -i {{ deploy_dir }}/brainwave-arm64.tar.gz
register: docker_load_result
changed_when: "'Loaded image' in docker_load_result.stdout"
- name: Start container
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ deploy_dir }}"
register: compose_up
changed_when: "'Started' in compose_up.stdout or 'Created' in compose_up.stdout or 'Recreating' in compose_up.stdout"