Install packages with specific versions in single transaction

Hello.

As documentation says I can write construction like that:

`
apt: name={{ item }} state=present
with_items:

  • package1
  • package2
    `

and have single transaction to package management system:

ok: [foo.bar] => (item=package1,package2)

My question is how can I install multiple (many in fact) packages with specific versions still in one transaction?
Approach with ‘with_dict’ loop

`

  • apt: name={{ item.key }}={{ item.value }} state=present
    with_dict: “{{many_many_packages}}”
    `
    still generates one command per key in dictionary.

Thank in advance, Daniil.