53 lines
1.9 KiB
YAML
53 lines
1.9 KiB
YAML
# vim: set filetype=yaml.ansible :
|
|
#
|
|
## Helpers: archive.yml
|
|
## Description: extract and symlink archives
|
|
## Variables: dict of key:value pairs
|
|
## extract_to: path to extract archive to
|
|
## name: filename of the archive
|
|
## url: download url of the archive
|
|
---
|
|
- name: Ensure requirements met
|
|
when:
|
|
- archive.extract_to is defined
|
|
- archive.name is defined
|
|
- archive.url is defined
|
|
block:
|
|
- name: Extract archive to given path {{ archive.name }}
|
|
block:
|
|
- name: Ensure directory exists
|
|
become: "{{ install_become }}"
|
|
become_user: "{{ install_become_user }}"
|
|
ansible.builtin.file:
|
|
state: directory
|
|
path: "{{ archive.extract_to }}"
|
|
mode: "{{ archive.mode | default('0755') }}"
|
|
owner: "{{ archive.owner | default(ansible_facts['user_id']) }}"
|
|
group: "{{ archive.group | default(ansible_facts['user_gid']) }}"
|
|
|
|
- name: Download archive to cache {{ archive.name }}
|
|
ansible.builtin.get_url:
|
|
dest: "{{ d_cache.path }}/{{ archive.name }}"
|
|
url: "{{ archive.url }}"
|
|
checksum: "{{ archive.checksum | default(omit) }}"
|
|
decompress: false
|
|
mode: '0644'
|
|
|
|
- name: Extract archive {{ archive.name }}
|
|
become: "{{ install_become }}"
|
|
become_user: "{{ install_become_user }}"
|
|
ansible.builtin.unarchive:
|
|
dest: "{{ archive.extract_to }}"
|
|
src: "{{ d_cache.path }}/{{ archive.name }}"
|
|
remote_src: true
|
|
include: "{{ archive.include | default(omit) }}"
|
|
exclude: "{{ archive.exclude | default(omit) }}"
|
|
|
|
- name: Symlink archive files {{ archive.name }}
|
|
when:
|
|
- archive.links is defined
|
|
- archive.links | length > 0
|
|
vars:
|
|
links: "{{ archive.links }}"
|
|
ansible.builtin.include_tasks: helpers/symlink.yml
|