1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Ansible_Project/roles/ansistrano.deploy/tasks/symlink-shared.yml

34 lines
1.4 KiB
YAML
Raw Normal View History

2022-05-02 17:37:08 +02:00
---
# Ensure symlinks target paths is absent
# This was removed in 1.7.3 to improve speed but it introduced regressions in cases where
# there are .gitkeep files in such folders (common practice in some PHP frameworks)
- name: ANSISTRANO | Ensure shared paths targets are absent
file:
state: absent
path: "{{ ansistrano_release_path.stdout }}/{{ item }}"
loop: "{{ (ansistrano_shared_paths | flatten ) + (ansistrano_shared_files | flatten) }}"
# Symlinks shared paths and files
- name: ANSISTRANO | Create softlinks for shared paths and files
file:
state: link
path: "{{ ansistrano_release_path.stdout }}/{{ item }}"
src: "{{ item | regex_replace('[^\\/]+', '..') }}/../shared/{{ item }}"
loop: "{{ (ansistrano_shared_paths | flatten ) + (ansistrano_shared_files | flatten) }}"
# Remove previous .rsync-filter file (rsync current deployment)
- name: ANSISTRANO | Ensure .rsync-filter is absent
file:
state: absent
path: "{{ ansistrano_release_path.stdout }}/.rsync-filter"
when: ansistrano_current_via == "rsync"
# Setup .rsync-filter file for current rsync deployment (exclude shared folders for rsync current deployment)
- name: ANSISTRANO | Setup .rsync-filter with shared-folders
lineinfile:
dest: "{{ ansistrano_release_path.stdout }}/.rsync-filter"
line: "- /{{ item }}"
create: yes
loop: "{{ (ansistrano_shared_paths | flatten ) + (ansistrano_shared_files | flatten) }}"
when: ansistrano_current_via == "rsync"