Without with_items - its worked. When I specify yum/apt instead {{ ansible_pkg_mgr }} - it’s worked.
How I can combine with_items and {{ ansible_pkg_mgr }} together?
Generally I try to use YAML only and avoid Ansible's syntax (with equal
signs). However, with free-form arguments, it's hard to avoid it. IMHO,
it's too much flexibility and backward compatibility, but that's because
I don't have a "legacy" code base to worry about.
It's designed to work on one package at a time. IMHO, working on
multiple packages simultaneously will complicate the module because now
it has to parse yum's output and understand it, instead of just relying
on yum's return code.
You could use the shell/command modules, but they will warn you to use
the yum module instead ("Consider using yum module rather than running
yum"). In fact, it'll warn you about using any of the commands listed
here: http://bit.ly/1ClYXgl