0d46934bb6
Change-Id: Ie3f8b130efb0c0d95c09f939e4fce234a0436a1a
53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
---
|
|
|
|
- name: "ensure '{{ project_dest_dir }}' exists"
|
|
become: true
|
|
become_user: root
|
|
file:
|
|
path: '{{ project_dest_dir | realpath }}'
|
|
state: directory
|
|
mode: '0755'
|
|
owner: stack
|
|
group: stack
|
|
when: >-
|
|
( project_src_dir | length) > 0 or
|
|
( project_git_repo | length) > 0
|
|
|
|
|
|
- name: "check '{{ project_src_dir }}' exists"
|
|
stat:
|
|
path: '{{ project_src_dir }}'
|
|
delegate_to: localhost
|
|
register: check_project_src_dir_exists
|
|
when: ( project_src_dir | length) > 0
|
|
|
|
|
|
- become: true
|
|
become_user: stack
|
|
block:
|
|
|
|
- name: copy '{{ project_src_dir }}' to '{{ project_dest_dir }}'
|
|
synchronize:
|
|
group: false
|
|
owner: false
|
|
src: "{{ project_src_dir | realpath }}/."
|
|
dest: "{{ project_dest_dir | realpath }}"
|
|
use_ssh_args: true
|
|
recursive: true
|
|
rsync_opts:
|
|
- '--exclude-from={{ project_src_dir | realpath }}/.gitignore'
|
|
register: copy_project_src_dir
|
|
when: check_project_src_dir_exists.stat.isdir | default(False)
|
|
|
|
- name: >-
|
|
fetch project sources from '{{ project_git_repo }}' to
|
|
'{{ project_dest_dir }}'
|
|
git:
|
|
repo: '{{ project_git_repo }}'
|
|
dest: '{{ project_dest_dir }}'
|
|
version: '{{ project_git_version }}'
|
|
force: true
|
|
when:
|
|
- copy_project_src_dir is skipped
|
|
- ( project_git_repo | length) > 0
|