42 lines
1.4 KiB
YAML
42 lines
1.4 KiB
YAML
|
---
|
||
|
|
||
|
# Migration check from symlink deployment
|
||
|
- name: ANSISTRANO | Get current folder
|
||
|
stat:
|
||
|
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}"
|
||
|
register: stat_current_dir
|
||
|
|
||
|
- name: ANSISTRANO | Remove current folder if it's a symlink
|
||
|
file:
|
||
|
state: absent
|
||
|
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}"
|
||
|
when: stat_current_dir.stat.islnk is defined and stat_current_dir.stat.islnk
|
||
|
|
||
|
# Perform rsync deployment
|
||
|
- name: ANSISTRANO | Ensure current folder is a directory
|
||
|
file:
|
||
|
state: directory
|
||
|
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}"
|
||
|
|
||
|
- name: ANSISTRANO | Sync release to new current path
|
||
|
command: rsync -a -F --no-times --delete-after "{{ ansistrano_release_path.stdout }}/" "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/"
|
||
|
|
||
|
# Ensure symlinks target paths is absent
|
||
|
- name: ANSISTRANO | Ensure shared paths targets are absent
|
||
|
file:
|
||
|
state: absent
|
||
|
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/{{ item }}"
|
||
|
with_flattened:
|
||
|
- "{{ ansistrano_shared_paths }}"
|
||
|
- "{{ ansistrano_shared_files }}"
|
||
|
|
||
|
# Symlinks shared paths
|
||
|
- name: ANSISTRANO | Create softlinks for shared paths
|
||
|
file:
|
||
|
state: link
|
||
|
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/{{ item }}"
|
||
|
src: "{{ item | regex_replace('[^\\/]+', '..') }}/shared/{{ item }}"
|
||
|
with_flattened:
|
||
|
- "{{ ansistrano_shared_paths }}"
|
||
|
- "{{ ansistrano_shared_files }}"
|