auto package version selection?

Hi,

I’m deploying an application via Ansible on Ubuntu. The application’s .deb requires several php modules but misses some so in my playbook I have the following.

  • name: Install php packages
    apt: name={{item}} state=installed
    with_items:
  • php5-gd
  • php5-imagick
  • php5-pgsql

Is there a way to do the above without specifying ‘5’ so that apt or Ansible will automatically select the version of php modules to install based on the existing php package versions installed?

Assuming you know ahead of time or have a way of finding out during playbook execution which version is installed I don’t see why it wouldn’t be possible. You could create a couple of yaml dictionaries for the purpose and iterate over whichever one is appropriate using a when statement.