Team, i need to run a task on all nodes by pulling nodes using with_items then using with_nested I need to perferm check on each of the node pulled in with_item. any hint?
I cannot run this from playbook. I have to run it from tasks file inside role.
- name: verify if kernel modules exists nested loop
stat:
path: /lib/modules/{{ kernel_version }}/kernel/{{ item.dir }}/{{ item.module_name }}
checksum_algorithm: sha1
register: res
failed_when: res.stat.checksum != item.sha1
with_nested:
- { dir: fs/fscache, module_name: fscache.ko, sha1: "{{ checksum.fscache }}" }
- { dir: fs/cachefiles, module_name: cachefiles.ko, sha1: "{{ checksum.cachefiles }}" }
- { dir: fs/isofs, module_name: isofs.ko, sha1: "{{ checksum.isofs }}" }
- { dir: drivers/target , module_name: target_core_user.ko, sha1: "{{ checksum.target_core_user }}" }
- { dir: drivers/target/loopback , module_name: tcm_loop.ko, sha1: "{{ checksum.tcm_loop }}" }
delegate_to: "{{ item }}"
with_items: "{{ groups['kube-gpu-node'] }}"
output:
ERROR! duplicate loop in task: nested
The error appears to be in '/k8s/baremetal/roles/test-services-pre-install-checks/tasks/main.yml': line 166, column 9, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: verify if kernel modules exists nested loop
^ here