Files
ansible_role_package/tasks/helpers/install.yml
Matthew Stobbs e39c3b7046 working on cleanup and fixing a few format issues
- modifying how installs are done
2026-02-15 17:57:05 -07:00

41 lines
1.4 KiB
YAML

# vim: set filetype=yaml.ansible :
#
## Helper: install.yml
## Description: install files defined in dict
## Variables:
## _Note_ This is mutually exclusive to having a 'to' key
## - directory: path prefixed by {{ install_prefix }} of a directory to
## be created
## mode: _optional_, _default_ '0755'
##
## _Note_ This is mutually exclusive to having a 'directory' key
## - to: where to install file to, prefixed with {{ install_prefix }}
## from: source file from build path root for package
## mode: _optional_, _default_ '0644'##
##
## Notes: This is only used when copying files or creating directories
## for installing. If a source package doesn't require you to manually
## copy anthing (go install, as an example), don't use this.
---
- name: Create directories
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ pkg_clean }}"
loop_control:
loop_var: dir
when:
- dir.directory is defined
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ install_prefix }}/{{ dir.directory }}"
- name: Copy installable files
become: "{{ install_become }}"
become_user: "{{ install_become_user }}"
loop: "{{ pkg_clean }}"
ansible.builtin.copy:
dest: "{{ install_prefix }}/{{ file.to }}"
mode: "{{ file.mode | default('0644') }}"
src: "{{ file.builddir | default(omit) }}/"