From 2b1c714375b6050c27514fc6e1ed7db51fb22210 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Wed, 23 Jul 2025 14:43:05 +0200 Subject: [PATCH] updated utils.yml to work with latest ansible Signed-off-by: Menno van Leeuwen --- config/ansible/tasks/global/utils.yml | 64 ++++++++++++++------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/config/ansible/tasks/global/utils.yml b/config/ansible/tasks/global/utils.yml index 004c946..9c4bcbd 100644 --- a/config/ansible/tasks/global/utils.yml +++ b/config/ansible/tasks/global/utils.yml @@ -1,35 +1,39 @@ --- -- name: Load DOTFILES_PATH environment variable - ansible.builtin.set_fact: - dotfiles_path: "{{ lookup('env', 'DOTFILES_PATH') }}" - become: false +- name: Process utils files + block: + - name: Load DOTFILES_PATH environment variable + ansible.builtin.set_fact: + dotfiles_path: "{{ lookup('env', 'DOTFILES_PATH') }}" + become: false -- name: Ensure ~/.local/bin exists - ansible.builtin.file: - path: "{{ ansible_env.HOME }}/.local/bin" - state: directory - mode: "0755" - become: false + - name: Ensure ~/.local/bin exists + ansible.builtin.file: + path: "{{ ansible_env.HOME }}/.local/bin" + state: directory + mode: "0755" + become: false -- name: Scan utils folder and create symlinks in ~/.local/bin - ansible.builtin.find: - paths: "{{ dotfiles_path }}/config/ansible/tasks/global/utils" - file_type: file - register: utils_files - become: false + - name: Scan utils folder and create symlinks in ~/.local/bin + ansible.builtin.find: + paths: "{{ dotfiles_path }}/config/ansible/tasks/global/utils" + file_type: file + register: utils_files + become: false -- name: Create symlinks for utils scripts - ansible.builtin.file: - src: "{{ item.path }}" - dest: "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename }}" - state: link - loop: "{{ utils_files.files }}" - when: not item.path | regex_search('\.go$') - become: false + - name: Create symlinks for utils scripts + ansible.builtin.file: + src: "{{ item.path }}" + dest: "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename }}" + state: link + loop: "{{ utils_files.files }}" + when: not item.path.endswith('.go') + become: false -- name: Compile Go files and place binaries in ~/.local/bin - ansible.builtin.command: - cmd: go build -o "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename | regex_replace('\.go$', '') }}" "{{ item.path }}" - loop: "{{ utils_files.files }}" - when: item.path | regex_search('\.go$') - become: false + - name: Compile Go files and place binaries in ~/.local/bin + ansible.builtin.command: + cmd: go build -o "{{ ansible_env.HOME }}/.local/bin/{{ item.path | basename | regex_replace('\.go$', '') }}" "{{ item.path }}" + loop: "{{ utils_files.files }}" + when: item.path.endswith('.go') + become: false + tags: + - utils