Public Access
fix: use ansible_user for deploy path and add changed_when guards
This commit is contained in:
1 parent
2cbc710fb2
commit
6a3e2ed4d1
1 file changed
+17
-10
+17
-10
@@ -2,28 +2,35 @@
|
|||||||
- name: Deploy Brainwave ARM to OrangePi
|
- name: Deploy Brainwave ARM to OrangePi
|
||||||
hosts: orangepi
|
hosts: orangepi
|
||||||
gather_facts: false
|
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:
|
tasks:
|
||||||
- name: Ensure deploy directory exists
|
- name: Ensure deploy directory exists
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /home/user/brainwave
|
path: "{{ deploy_dir }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
- name: Copy ARM tarball
|
- name: Copy ARM tarball
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ artifact_path }}/brainwave-arm64.tar.gz"
|
src: "{{ artifact_path }}/brainwave-arm64.tar.gz"
|
||||||
dest: /home/user/brainwave/brainwave-arm64.tar.gz
|
dest: "{{ deploy_dir }}/brainwave-arm64.tar.gz"
|
||||||
|
|
||||||
- name: Copy docker-compose file
|
- name: Copy ARM docker-compose file
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ artifact_path }}/docker-compose.arm64.yml"
|
src: "{{ artifact_path }}/docker-compose.arm64.yml"
|
||||||
dest: /home/user/brainwave/docker-compose.yml
|
dest: "{{ deploy_dir }}/docker-compose.yml"
|
||||||
|
|
||||||
- name: Load Docker image
|
- name: Load Docker image
|
||||||
command: docker load -i /home/user/brainwave/brainwave-arm64.tar.gz
|
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
|
- name: Start container
|
||||||
command: docker compose up -d
|
ansible.builtin.command: docker compose up -d
|
||||||
args:
|
args:
|
||||||
chdir: /home/user/brainwave
|
chdir: "{{ deploy_dir }}"
|
||||||
|
changed_when: true
|
||||||
Reference in new issue
Block a user