Cloud VM #7
|
@ -2,7 +2,7 @@
|
||||||
hosts: cloud
|
hosts: cloud
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
vars:
|
vars:
|
||||||
project: cloud
|
app: nextcloud
|
||||||
tasks:
|
tasks:
|
||||||
- name: Wait for connection
|
- name: Wait for connection
|
||||||
ansible.builtin.wait_for_connection:
|
ansible.builtin.wait_for_connection:
|
||||||
|
@ -13,16 +13,10 @@
|
||||||
register: user
|
register: user
|
||||||
- name: Copy project
|
- name: Copy project
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: ./{{ project }}
|
src: ./{{ app }}
|
||||||
dest: "{{ user.home }}"
|
dest: "{{ user.home }}"
|
||||||
mode: "0744"
|
mode: "0744"
|
||||||
notify: re-deploy
|
- name: Re-deploy
|
||||||
handlers:
|
ansible.builtin.command: bash all-in-one.sh
|
||||||
- name: Restart Docker compose
|
|
||||||
ansible.builtin.shell: |
|
|
||||||
docker compose down
|
|
||||||
docker compose up -d
|
|
||||||
exit 0
|
|
||||||
args:
|
args:
|
||||||
chdir: "{{ user.home }}/{{ project }}"
|
chdir: "{{ user.home }}/{{ app }}"
|
||||||
listen: re-deploy
|
|
|
@ -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"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
test:
|
dummy:
|
||||||
image: nginx
|
image: nginx
|
||||||
restart: unless-stopped
|
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