I want to to install some packages to several almalinux hosts
- name: “docker=install”
delegate_to: “{{ item }}”
dnf:
name: - ‘https://download.docker.com/linux/rhel/8/source/stable/Packages/docker-ce-20.10.15-3.el8.src.rpm’
- yum-utils
- device-mapper-persistent-data
- lvm2
state: present
loop: - k8s-master
- k8s-node-1
this TASK works, but I was thinking whether I could put the packages into a loop also (which would result into 2 loops in one TASK)
Can this be done? If so … ‘how’?
I tried to nest it like this
- name: “docker=install”
delegate_to: “{{ item }}”
dnf:
name: “{{ item }}”
state: present
loop: - ‘https://download.docker.com/linux/rhel/8/source/stable/Packages/docker-ce-20.10.15-3.el8.src.rpm’
- yum-utils
- device-mapper-persistent-data
- lvm2
loop: - k8s-master
- k8s-node-1
but execution failed with an “unsupported paramter for dnf module: loop” error