I'm building a role for which I'm trying to gather disks without any partitions using
disks: "{{ ansible_devices | dict2items | selectattr('key', 'match', '^sd.*') | selectattr('value.partitions', 'match', '{}' ) | list }}"
and then mount on the partition. But, as I'm running over a loop I wanted to update the list/disks when the mount and partition is completed.
For example, if my list at the start looks like
disks: [sdb,sdc,sdd,sde]
when the partitioning and mounting on sdb using the mount module in Ansible is done, the list should be updated and look something like this
disks: [sdc,sdd,sde]
How can I achieve this?