updated utils.yml to work with latest ansible
Signed-off-by: Menno van Leeuwen <menno@vleeuwen.me>
This commit is contained in:
@@ -1,35 +1,39 @@
|
|||||||
---
|
---
|
||||||
- name: Load DOTFILES_PATH environment variable
|
- name: Process utils files
|
||||||
|
block:
|
||||||
|
- name: Load DOTFILES_PATH environment variable
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
dotfiles_path: "{{ lookup('env', 'DOTFILES_PATH') }}"
|
dotfiles_path: "{{ lookup('env', 'DOTFILES_PATH') }}"
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
- name: Ensure ~/.local/bin exists
|
- name: Ensure ~/.local/bin exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ ansible_env.HOME }}/.local/bin"
|
path: "{{ ansible_env.HOME }}/.local/bin"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
- name: Scan utils folder and create symlinks in ~/.local/bin
|
- name: Scan utils folder and create symlinks in ~/.local/bin
|
||||||
ansible.builtin.find:
|
ansible.builtin.find:
|
||||||
paths: "{{ dotfiles_path }}/config/ansible/tasks/global/utils"
|
paths: "{{ dotfiles_path }}/config/ansible/tasks/global/utils"
|
||||||
file_type: file
|
file_type: file
|
||||||
register: utils_files
|
register: utils_files
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
- name: Create symlinks for utils scripts
|
- name: Create symlinks for utils scripts
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
src: "{{ item.path }}"
|
src: "{{ item.path }}"
|
||||||
dest: "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename }}"
|
dest: "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename }}"
|
||||||
state: link
|
state: link
|
||||||
loop: "{{ utils_files.files }}"
|
loop: "{{ utils_files.files }}"
|
||||||
when: not item.path | regex_search('\.go$')
|
when: not item.path.endswith('.go')
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
- name: Compile Go files and place binaries in ~/.local/bin
|
- name: Compile Go files and place binaries in ~/.local/bin
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: go build -o "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename | regex_replace('\.go$', '') }}" "{{ item.path }}"
|
cmd: go build -o "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename | regex_replace('\.go$', '') }}" "{{ item.path }}"
|
||||||
loop: "{{ utils_files.files }}"
|
loop: "{{ utils_files.files }}"
|
||||||
when: item.path | regex_search('\.go$')
|
when: item.path.endswith('.go')
|
||||||
become: false
|
become: false
|
||||||
|
tags:
|
||||||
|
- utils
|
||||||
|
Reference in New Issue
Block a user