From f1cbe79f7573a383ff084cd99e00a36e457fdaef Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Wed, 4 Mar 2026 00:57:15 +0100 Subject: Refactor ansible/yamllint roles to use mise --- group_vars/all.yml | Bin 4454 -> 4326 bytes host_vars/archlinux.local.yml | Bin 1245 -> 1361 bytes host_vars/archlinux.local.yml.example | 7 ++++--- host_vars/mac.local.yml | Bin 1073 -> 1189 bytes host_vars/mac.local.yml.example | 6 ++++-- roles/ansible/meta/main.yml | 2 ++ roles/ansible/tasks/main.yml | 28 +++++++++++++++++++--------- roles/yamllint/meta/main.yml | 1 + roles/yamllint/tasks/main.yml | 11 ++++------- 9 files changed, 34 insertions(+), 21 deletions(-) diff --git a/group_vars/all.yml b/group_vars/all.yml index 55b74c37..cba875ac 100644 Binary files a/group_vars/all.yml and b/group_vars/all.yml differ diff --git a/host_vars/archlinux.local.yml b/host_vars/archlinux.local.yml index f4d0568e..73aba2f6 100644 Binary files a/host_vars/archlinux.local.yml and b/host_vars/archlinux.local.yml differ diff --git a/host_vars/archlinux.local.yml.example b/host_vars/archlinux.local.yml.example index e8bad3f4..87de2580 100644 --- a/host_vars/archlinux.local.yml.example +++ b/host_vars/archlinux.local.yml.example @@ -19,9 +19,10 @@ nodejs_versions: python_versions: - "3.13.7" - "3.12.11" - -ansible_core_version: "2.18.7" -molecule_version: "25.7.0" +ansible_core_version: "2.20.1" +molecule_version: "25.9.0" +ansible_lint_version: "25.9.2" +yamllint_version: "1.37.1" wireguard_connections: wg-vpn1: | diff --git a/host_vars/mac.local.yml b/host_vars/mac.local.yml index bfb759f7..78e5711c 100644 Binary files a/host_vars/mac.local.yml and b/host_vars/mac.local.yml differ diff --git a/host_vars/mac.local.yml.example b/host_vars/mac.local.yml.example index c301010c..99936ff4 100644 --- a/host_vars/mac.local.yml.example +++ b/host_vars/mac.local.yml.example @@ -19,8 +19,10 @@ nodejs_versions: python_versions: - "3.13.7" - "3.12.11" -ansible_core_version: "2.18.7" -molecule_version: "25.7.0" +ansible_core_version: "2.20.1" +molecule_version: "25.9.0" +ansible_lint_version: "25.9.2" +yamllint_version: "1.37.1" wireguard_connections: wg-vpn1: | diff --git a/roles/ansible/meta/main.yml b/roles/ansible/meta/main.yml index 3611082e..d8f2ab7f 100644 --- a/roles/ansible/meta/main.yml +++ b/roles/ansible/meta/main.yml @@ -1,5 +1,7 @@ --- dependencies: + - role: "bash" + - role: "mise" - role: "python" - role: "sshpass" - role: "yamllint" diff --git a/roles/ansible/tasks/main.yml b/roles/ansible/tasks/main.yml index b5ac2066..e5477416 100644 --- a/roles/ansible/tasks/main.yml +++ b/roles/ansible/tasks/main.yml @@ -9,47 +9,57 @@ - name: "Check ansible-core version {{ ansible_core_version }}" ansible.builtin.shell: | set -euo pipefail - uv tool list | grep "^ansible-core " | awk '{print $2}' | sed 's/^v//' + mise exec uv -- tool list | grep "^ansible-core " | awk '{print $2}' | sed 's/^v//' args: executable: /bin/bash register: ansible_core_installed_version changed_when: false failed_when: false -- name: "Install ansible core version {{ ansible_core_version }}" +- name: "Install ansible-core {{ ansible_core_version }}" ansible.builtin.command: - cmd: "uv tool install ansible-core=={{ ansible_core_version }} --force" + cmd: "mise exec uv -- tool install ansible-core=={{ ansible_core_version }} --force" changed_when: true when: ansible_core_installed_version.stdout != ansible_core_version - name: "Check molecule version {{ molecule_version }}" ansible.builtin.shell: | set -euo pipefail - uv tool list | grep "^molecule " | awk '{print $2}' | sed 's/^v//' + mise exec uv -- tool list | grep "^molecule " | awk '{print $2}' | sed 's/^v//' args: executable: /bin/bash register: molecule_installed_version changed_when: false failed_when: false -- name: "Install molecule version {{ molecule_version }}" +- name: "Install molecule {{ molecule_version }}" ansible.builtin.command: - cmd: "uv tool install molecule=={{ molecule_version }} --with 'molecule-plugins[docker,podman]' --force" + argv: + - "mise" + - "exec" + - "uv" + - "--" + - "tool" + - "install" + - "molecule=={{ molecule_version }}" + - "--with" + - "molecule-plugins[docker,podman]" + - "--force" changed_when: true when: molecule_installed_version.stdout != molecule_version - name: "Check ansible-lint version {{ ansible_lint_version }}" ansible.builtin.shell: | set -euo pipefail - uv tool list | grep "^ansible-lint " | awk '{print $2}' | sed 's/^v//' + mise exec uv -- tool list | grep "^ansible-lint " | awk '{print $2}' | sed 's/^v//' args: executable: /bin/bash register: ansible_lint_installed_version changed_when: false failed_when: false -- name: "Install ansible lint version {{ ansible_lint_version }}" +- name: "Install ansible-lint {{ ansible_lint_version }}" ansible.builtin.command: - cmd: "uv tool install ansible-lint=={{ ansible_lint_version }} --force" + cmd: "mise exec uv -- tool install ansible-lint=={{ ansible_lint_version }} --force" changed_when: true when: ansible_lint_installed_version.stdout != ansible_lint_version diff --git a/roles/yamllint/meta/main.yml b/roles/yamllint/meta/main.yml index 2cf216b5..4daf5d20 100644 --- a/roles/yamllint/meta/main.yml +++ b/roles/yamllint/meta/main.yml @@ -1,6 +1,7 @@ --- dependencies: - role: "bash" + - role: "mise" - role: "python" galaxy_info: author: "a14m" diff --git a/roles/yamllint/tasks/main.yml b/roles/yamllint/tasks/main.yml index 4ca2d2ba..609feed5 100644 --- a/roles/yamllint/tasks/main.yml +++ b/roles/yamllint/tasks/main.yml @@ -2,18 +2,15 @@ - name: "Check yamllint version {{ yamllint_version }}" ansible.builtin.shell: | set -euo pipefail - uv tool list | grep "^yamllint " | awk '{print $2}' | sed 's/^v//' + mise exec uv -- tool list | grep "^yamllint " | awk '{print $2}' | sed 's/^v//' args: executable: /bin/bash register: yamllint_installed_version changed_when: false failed_when: false -- name: "Install yamllint version {{ yamllint_version }}" - ansible.builtin.shell: | - set -euo pipefail - uv tool install yamllint=={{ yamllint_version }} --force - args: - executable: /bin/bash +- name: "Install yamllint {{ yamllint_version }}" + ansible.builtin.command: + cmd: "mise exec uv -- tool install yamllint=={{ yamllint_version }} --force" changed_when: true when: yamllint_installed_version.stdout != yamllint_version -- cgit v1.2.3