Cloud VM #7
|
@ -2,7 +2,7 @@
|
|||
hosts: cloud
|
||||
gather_facts: false
|
||||
vars:
|
||||
project: cloud
|
||||
app: nextcloud
|
||||
tasks:
|
||||
- name: Wait for connection
|
||||
ansible.builtin.wait_for_connection:
|
||||
|
@ -13,16 +13,10 @@
|
|||
register: user
|
||||
- name: Copy project
|
||||
ansible.builtin.copy:
|
||||
src: ./{{ project }}
|
||||
src: ./{{ app }}
|
||||
dest: "{{ user.home }}"
|
||||
mode: "0744"
|
||||
notify: re-deploy
|
||||
handlers:
|
||||
- name: Restart Docker compose
|
||||
ansible.builtin.shell: |
|
||||
docker compose down
|
||||
docker compose up -d
|
||||
exit 0
|
||||
- name: Re-deploy
|
||||
ansible.builtin.command: bash all-in-one.sh
|
||||
args:
|
||||
chdir: "{{ user.home }}/{{ project }}"
|
||||
listen: re-deploy
|
||||
chdir: "{{ user.home }}/{{ app }}"
|
|
@ -0,0 +1,26 @@
|
|||
- name: Deploy app
|
||||
hosts: cloud
|
||||
gather_facts: false
|
||||
vars:
|
||||
app: immich
|
||||
tasks:
|
||||
- name: Wait for connection
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 300
|
||||
- name: Get user
|
||||
ansible.builtin.user:
|
||||
name: debian
|
||||
register: user
|
||||
- name: Docker compose down
|
||||
ansible.builtin.command: docker compose down
|
||||
args:
|
||||
chdir: "{{ user.home }}/{{ app }}"
|
||||
- name: Copy project
|
||||
ansible.builtin.copy:
|
||||
src: ./{{ app }}
|
||||
dest: "{{ user.home }}"
|
||||
mode: "0744"
|
||||
- name: Docker compose up -d
|
||||
ansible.builtin.command: docker compose up -d
|
||||
args:
|
||||
chdir: "{{ user.home }}/{{ app }}"
|
|
@ -1,6 +1,6 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
test:
|
||||
dummy:
|
||||
image: nginx
|
||||
restart: unless-stopped
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker stop nextcloud-aio-mastercontainer || true
|
||||
docker rm nextcloud-aio-mastercontainer || true
|
||||
|
||||
docker run \
|
||||
--init \
|
||||
--sig-proxy=false \
|
||||
--name nextcloud-aio-mastercontainer \
|
||||
--restart unless-stopped \
|
||||
--publish 8080:8080 \
|
||||
--env APACHE_PORT=11000 \
|
||||
--env APACHE_IP_BINDING=0.0.0.0 \
|
||||
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
|
||||
-d nextcloud/all-in-one:latestdocker run
|
Loading…
Reference in New Issue