[PATCH 04/10] playbooks: ansible-lint fix command-instead-of-shell

Daniel Gomez <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Daniel Gomez <[email protected]>

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>
---
 playbooks/nixos.yml                                          | 12 ++++++------
 .../roles/ai_multifs_run/tasks/run_single_filesystem.yml     |  2 +-
 playbooks/roles/ai_run_benchmarks/tasks/main.yml             |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/playbooks/nixos.yml b/playbooks/nixos.yml
index 66afac4f..2c959a3a 100644
--- a/playbooks/nixos.yml
+++ b/playbooks/nixos.yml
@@ -321,14 +321,14 @@
   tags: bringup
   tasks:
     - name: Check if default network exists and is active
-      ansible.builtin.shell: virsh net-info default
+      ansible.builtin.command: virsh net-info default
       register: default_network_info
       failed_when: false
       environment:
         LIBVIRT_DEFAULT_URI: "{{ libvirt_uri }}"
 
     - name: Start default network if not active
-      ansible.builtin.shell: virsh net-start default
+      ansible.builtin.command: virsh net-start default
       when: default_network_info.rc != 0 or 'Active:' not in default_network_info.stdout or 'yes' not in default_network_info.stdout.split('Active:')[1].split('\n')[0]
       failed_when: false
       environment:
@@ -342,7 +342,7 @@
   tags: bringup
   tasks:
     - name: Check if VM already exists
-      ansible.builtin.shell: virsh domstate "{{ inventory_hostname }}"
+      ansible.builtin.command: virsh domstate "{{ inventory_hostname }}"
       register: vm_status
       failed_when: false
       delegate_to: localhost
@@ -366,15 +366,15 @@
             vm_disk: "{{ nixos_storage_dir }}/{{ inventory_hostname }}.qcow2"
 
         - name: Define VM in libvirt
-          ansible.builtin.shell: virsh define "{{ nixos_storage_dir }}/{{ inventory_hostname }}.xml"
+          ansible.builtin.command: virsh define "{{ nixos_storage_dir }}/{{ inventory_hostname }}.xml"
           failed_when: false
 
         - name: Start VM
-          ansible.builtin.shell: virsh start "{{ inventory_hostname }}"
+          ansible.builtin.command: virsh start "{{ inventory_hostname }}"
           failed_when: false
 
     - name: Ensure VM is running
-      ansible.builtin.shell: virsh start "{{ inventory_hostname }}"
+      ansible.builtin.command: virsh start "{{ inventory_hostname }}"
       register: start_result
       failed_when:
         - start_result.rc != 0
diff --git a/playbooks/roles/ai_multifs_run/tasks/run_single_filesystem.yml b/playbooks/roles/ai_multifs_run/tasks/run_single_filesystem.yml
index 173ac18c..a4ed4cdd 100644
--- a/playbooks/roles/ai_multifs_run/tasks/run_single_filesystem.yml
+++ b/playbooks/roles/ai_multifs_run/tasks/run_single_filesystem.yml
@@ -10,7 +10,7 @@
   ignore_errors: true
 
 - name: Create filesystem with specific configuration
-  shell: "{{ fs_config.mkfs_cmd }} {{ ai_multifs_device }}"
+  ansible.builtin.command: "{{ fs_config.mkfs_cmd }} {{ ai_multifs_device }}"
   register: mkfs_result
 
 - name: Display mkfs output
diff --git a/playbooks/roles/ai_run_benchmarks/tasks/main.yml b/playbooks/roles/ai_run_benchmarks/tasks/main.yml
index 62f98fe0..587fa8ee 100644
--- a/playbooks/roles/ai_run_benchmarks/tasks/main.yml
+++ b/playbooks/roles/ai_run_benchmarks/tasks/main.yml
@@ -176,6 +176,6 @@
       when: lock_created is defined and lock_created.changed
 
     - name: Ensure lock file is removed (fallback)
-      ansible.builtin.shell: rm -f {{ ai_benchmark_results_dir }}/.benchmark.lock
+      ansible.builtin.command: rm -f {{ ai_benchmark_results_dir }}/.benchmark.lock
       failed_when: false
       when: lock_created is defined

-- 
2.50.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.