auto package version selection?

13 views
Skip to first unread message

da...@rootleveltech.com

unread,
Oct 24, 2016, 3:23:24 PM10/24/16
to Ansible Project
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? 

Alexander H. Laughlin

unread,
Oct 24, 2016, 7:38:18 PM10/24/16
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages