Files
ansible_role_package/tasks/helpers/archive.yml
Matthew Stobbs e231c6ae7a updating documentation
- giving things a better structure
- better documentation with the way things need to be as a standard
2026-02-04 22:26:15 -07:00

49 lines
1.6 KiB
YAML

# vim: set filetype=yaml.ansible :
---
- name: Ensure requirements met
when:
- pkg.extract_to is defined
- pkg.name is defined
- pkg.url is defined
block:
- name: Extract archive to given path
block:
- name: Ensure directory exists
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
ansible.bulitin.file:
state: directory
path: "{{ pkg.extract_to }}"
mode: "{{ pkg.mode | default('0755') }}"
owner: "{{ pkg.owner | default(ansible_user_id)}}"
group: "{{ pkg.group | default(ansible_user_gid) }}"
- name: Download archive to cache
ansible.builtin.get_url:
dest: "{{ d_cache }}/{{ pkg.name }}"
url: "{{ pkg.url }}"
checksum: "{{ pkg.checksum | default(omit) }}"
decompress: false
mode: '0644'
- name: Extract archive
ansible.builtin.unarchive:
dest: "{{ pkg.extract_to }}"
src: "{{ d_cache }}/{{ pkg.name }}"
remote_src: true
include: "{{ pkg.include | default(omit) }}"
exclude: "{{ pkg.exclude | default(omit) }}"
- name: Symlink archive files
when:
- pkg.bins is defined
- pkg.bins | length > 0
loop: pkg.bins
loop_control:
loop_var: lnk
ansible.builtin.file:
state: link
path: "{{ lnk.to }}"
src: "{{ lnk.from }}"
force: "{{ lnk.force | default(omit) }}"