65 lines
1.5 KiB
YAML
65 lines
1.5 KiB
YAML
---
|
|
|
|
- name: "clean target directory '{{ deploy_dir }}'"
|
|
file:
|
|
path: "{{ deploy_dir | realpath }}"
|
|
state: absent
|
|
when:
|
|
- (deploy_clean | bool)
|
|
|
|
|
|
- name: "ensure target directory exists: '{{ deploy_dir }}'"
|
|
file:
|
|
path: "{{ deploy_dir | realpath }}"
|
|
state: directory
|
|
register: create_dest_dir
|
|
|
|
|
|
- name: "checkout files from '{{ deploy_git_repo }}[{{ deploy_git_refspec }}]' to '{{ deploy_dir }}'"
|
|
git:
|
|
dest: '{{ deploy_dir }}'
|
|
repo: '{{ deploy_git_repo }}'
|
|
refspec: '{{ deploy_git_refspec }}'
|
|
version: FETCH_HEAD
|
|
remote: '{{ deploy_git_remote or omit }}'
|
|
force: yes
|
|
register: checkout_files
|
|
when:
|
|
- (deploy_git_refspec | length) > 0
|
|
|
|
|
|
- name: "copy '{{ deploy_src_dir }}' to '{{ deploy_dir }}'"
|
|
synchronize:
|
|
src: "{{ deploy_src_dir | realpath }}/."
|
|
dest: "{{ deploy_dir | realpath }}"
|
|
use_ssh_args: yes
|
|
recursive: yes
|
|
rsync_opts:
|
|
- '--exclude-from={{ deploy_src_dir | realpath }}/.gitignore'
|
|
register: copy_src_dir
|
|
when:
|
|
- (deploy_src_dir | length) > 0
|
|
- checkout_files is skipped
|
|
|
|
|
|
- name: "get last change details for '{{ deploy_dir }}'" # noqa 303
|
|
command:
|
|
chdir: "{{ deploy_dir }}"
|
|
cmd: git log -n 1
|
|
changed_when: no
|
|
register: get_git_log
|
|
|
|
|
|
- name: "show last change details"
|
|
debug: var=get_git_log.stdout_lines
|
|
|
|
|
|
# we install validations-common here since it's
|
|
# packaged by rhel-osp
|
|
- name: install validations-common
|
|
ignore_errors: yes
|
|
become: true
|
|
package:
|
|
name: validations-common
|
|
state: present
|