add symlink helper
- symlinking is done often enough that it makes sense to have a helper for it - move appimage and archive helpers to use symlink helper - fix formatting of air and alacritty
This commit is contained in:
@@ -23,7 +23,8 @@
|
||||
backup: false
|
||||
|
||||
- name: Link appimage to bin
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
|
||||
path: "{{ path_bin }}/{{ appimage.name }}"
|
||||
vars:
|
||||
links:
|
||||
- from: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
|
||||
to: "{{ path_bin }}/{{ appimage.name }}"
|
||||
ansible.builtin.include_tasks: helpers/symlink.yml
|
||||
|
||||
@@ -37,16 +37,9 @@
|
||||
exclude: "{{ archive.exclude | default(omit) }}"
|
||||
|
||||
- name: Symlink archive files
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
when:
|
||||
- archive.links is defined
|
||||
- archive.links | length > 0
|
||||
loop: "{{ archive.links }}"
|
||||
loop_control:
|
||||
loop_var: lnk
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
path: "{{ lnk.to }}"
|
||||
src: "{{ lnk.from }}"
|
||||
force: "{{ lnk.force | default(omit) }}"
|
||||
vars:
|
||||
links: "{{ archive.links }}"
|
||||
ansible.builtin.include_tasks: helpers/symlink.yml
|
||||
|
||||
20
tasks/helpers/symlink.yml
Normal file
20
tasks/helpers/symlink.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Helper: symlink.yml
|
||||
## Description: symlink source to target
|
||||
## Variables:
|
||||
## - from: the source of the symlink
|
||||
## - to: path of the symlink
|
||||
## - force: _optional_, force create the symlink
|
||||
---
|
||||
- name: Create symlinks
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
loop: "{{ links }}"
|
||||
loop_control:
|
||||
loop_var: link
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
path: "{{ link.to }}"
|
||||
src: "{{ link.from }}"
|
||||
force: "{{ link.force | default(omit) }}"
|
||||
Reference in New Issue
Block a user