Make sure we can copy files correctly to destination
This commit is contained in:
parent
b5af3c9b5d
commit
a9623b63f1
@ -4,5 +4,5 @@ packages:
|
|||||||
- rsync
|
- rsync
|
||||||
- wget
|
- wget
|
||||||
base_services:
|
base_services:
|
||||||
- portainer
|
- managers
|
||||||
services_configs_dir: ""
|
services_configs_dir: ""
|
@ -1,16 +1,18 @@
|
|||||||
file-servers:
|
file-server:
|
||||||
hosts:
|
hosts:
|
||||||
debianpx:
|
debianpx:
|
||||||
ansible_host: 192.168.122.177
|
ansible_host: 192.168.122.177
|
||||||
ansible_user: gabriel
|
ansible_user: gabriel
|
||||||
|
ansible_become: yes
|
||||||
|
ansible_become_method: sudo
|
||||||
vars:
|
vars:
|
||||||
services_dir: /home/gabriel/hosted
|
source_services_dir: /home/gabriel/hosted
|
||||||
services_configs_dir: /home/gabriel/hosted/configs
|
server_services_dir: /home/srv/services/configs
|
||||||
PERSISTENT_DIRECTORY: /home/gabriel/hosted/persistent
|
PERSISTENT_DIRECTORY: /home/srv/services/persistent
|
||||||
VOLATILE_DIRECTORY: /home/gabriel/hosted/volatile
|
# VOLATILE_DIRECTORY: /home/gabriel/hosted/volatile
|
||||||
BACKUPDIR: /home/gabriel/hosted/backup
|
# BACKUPDIR: /home/gabriel/hosted/backup
|
||||||
APPSDIR: /home/gabriel/hosted/apps
|
# APPSDIR: /home/gabriel/hosted/apps
|
||||||
MEDIADIR: /home/gabriel/hosted/media
|
# MEDIADIR: /home/gabriel/hosted/media
|
||||||
|
|
||||||
media-servers:
|
media-servers:
|
||||||
hosts:
|
hosts:
|
||||||
|
@ -1,12 +1,32 @@
|
|||||||
---
|
---
|
||||||
|
- name: Ensure services destination directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ server_services_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
owner: "{{ ansible_user | default('root') }}"
|
||||||
|
group: "{{ ansible_user | default('root') }}"
|
||||||
|
|
||||||
- name: Copy service folder
|
- name: Copy service folder
|
||||||
ansible.posix.synchronize:
|
ansible.builtin.copy:
|
||||||
src: "{{ services_dir }}/{{ item }}"
|
src: "{{ source_services_dir }}/{{ item }}"
|
||||||
dest: /services/
|
dest: "{{ server_services_dir }}"
|
||||||
|
mode: '0755'
|
||||||
|
owner: "{{ ansible_user | default('root') }}"
|
||||||
|
group: "{{ ansible_user | default('root') }}"
|
||||||
with_items: "{{ services }}"
|
with_items: "{{ services }}"
|
||||||
|
|
||||||
- name: Start Docker compose
|
- name: Docker Compose Start Service
|
||||||
community.docker.docker_compose:
|
community.docker.docker_compose_v2:
|
||||||
project_src: "/services/{{ item }}"
|
project_src: "{{ server_services_dir }}/{{ item }}"
|
||||||
environment: "{{ compose_env }}"
|
# environment: "{{ compose_env }}"
|
||||||
|
check_files_existing: true
|
||||||
|
assume_yes: true
|
||||||
|
build: policy
|
||||||
|
wait: true
|
||||||
|
register: output
|
||||||
with_items: "{{ services }}"
|
with_items: "{{ services }}"
|
||||||
|
async: 300
|
||||||
|
poll: 10
|
||||||
|
|
||||||
|
|
||||||
|
4
run.yml
4
run.yml
@ -6,12 +6,12 @@
|
|||||||
# vars_files:
|
# vars_files:
|
||||||
# - secret
|
# - secret
|
||||||
|
|
||||||
- hosts: file-servers
|
- hosts: file-server
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- role: webserver
|
- role: webserver
|
||||||
|
|
||||||
- hosts: media-servers
|
- hosts: media-server
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- role: webserver
|
- role: webserver
|
||||||
|
Loading…
x
Reference in New Issue
Block a user