mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Add block to download and unpack a remote archive
Signed-off-by: Philip Douglass <philip.douglass@amadeus.com>
This commit is contained in:
parent
b011e34fae
commit
6720cd9bda
@ -101,6 +101,65 @@
|
||||
tags:
|
||||
- update_insights
|
||||
|
||||
- block:
|
||||
- name: Ensure the project directory is present
|
||||
file:
|
||||
dest: "{{ project_path|quote }}"
|
||||
state: directory
|
||||
|
||||
- name: Get archive from url
|
||||
get_url:
|
||||
url: "{{ scm_url|quote }}"
|
||||
dest: "{{ project_path|quote }}"
|
||||
url_username: "{{ scm_username|default(omit) }}"
|
||||
url_password: "{{ scm_password|default(omit) }}"
|
||||
force_basic_auth: yes
|
||||
force: "{{ scm_clean }}"
|
||||
register: get_url_result
|
||||
|
||||
- name: Unpack archive
|
||||
unarchive:
|
||||
src: "{{ get_url_result.dest }}"
|
||||
dest: "{{ project_path|quote }}"
|
||||
keep_newer: "{{ not scm_clean }}"
|
||||
list_files: yes
|
||||
register: unarchived
|
||||
|
||||
- set_fact:
|
||||
archive_root_dirs: "{{ archive_root_dirs |default([]) |union(item.split('/')[0:1]) }}"
|
||||
loop: "{{ unarchived.files }}"
|
||||
|
||||
- block:
|
||||
- name: Delete unarchived single root directory
|
||||
file:
|
||||
dest: "{{ project_path|quote }}/{{ archive_root_dirs[0] }}"
|
||||
state: absent
|
||||
|
||||
- name: Link single root directory to project directory
|
||||
file:
|
||||
src: "{{ project_path|quote }}"
|
||||
dest: "{{ project_path|quote }}/{{ archive_root_dirs[0] }}"
|
||||
state: link
|
||||
|
||||
- name: Unpack archive
|
||||
unarchive:
|
||||
src: "{{ get_url_result.dest }}"
|
||||
dest: "{{ project_path|quote }}"
|
||||
keep_newer: "{{ not scm_clean }}"
|
||||
|
||||
- name: Delete link
|
||||
file:
|
||||
dest: "{{ project_path|quote }}/{{ archive_root_dirs[0] }}"
|
||||
state: absent
|
||||
when: archive_root_dirs |length == 1
|
||||
|
||||
- name: Set scm_version to archive sha1 checksum
|
||||
set_fact:
|
||||
scm_version: "{{ get_url_result.checksum_src }}"
|
||||
|
||||
tags:
|
||||
- update_archive
|
||||
|
||||
- name: Repository Version
|
||||
debug:
|
||||
msg: "Repository Version {{ scm_version }}"
|
||||
@ -109,6 +168,7 @@
|
||||
- update_hg
|
||||
- update_svn
|
||||
- update_insights
|
||||
- update_archive
|
||||
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user