Using facts as variables in a task main file

Hi,
I’m trying to install a package but the package manager varies across the distro. I’d like to implement something like this for e.g

  • name: install the latest version of vmware-tools
    {{ ansible_pkg_mgr }}: name=vmware-tools-esx-nox state=latest
    tags:
  • vmware-tools

Is this possible within the main tasks file?

Thanks

This is a bad idea because it won’t group multiple package installs into one transaction, so you’ll spend more time in updates, and also you don’t have the various apt controls that you need.

However, if you want to:

action: “{{ ansible_pkg_mgr }} name=blah state=latest”

Thanks - that works for me.