43 lines
1.4 KiB
YAML
43 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: "{{ do_become }}"
|
|
become_user: "{{ do_become_user | default(omit) }}"
|
|
loop: "{{ pkg.files }}"
|
|
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.files }}"
|
|
loop_control:
|
|
loop_var: file
|
|
ansible.builtin.copy:
|
|
dest: "{{ install_prefix }}/{{ file.to }}"
|
|
mode: "{{ file.mode | default('0644') }}"
|
|
src: "{{ source_dir }}/{{ file.from }}"
|