nice/ionice a module on target server

I have tried googling but have failed.

We use ansible to upgrade a fleet of VMs. Some of them are fairly small and apt in particular seems to really bog them down (yum/dnf isn’t that bad)

if we ssh in to the target we can run apt with nice/ionice

i.e.

sudo ionice -n 7 nice -n 19 apt-get dist-upgrade

which does the job of not completely disrupting the VM functionality.

However, I would prefer to continue to use the apt module within a playbook with Poll: 0 and monitor from within Ansible.

So is there to way to pass on nice/ionice within a module? I suppose I could use shell and a wrapper but I'd like to do it in the "ansible" way if possible.

Sincerely,

-wk