Is there an elegant way to find out what the version of an installed
package (say with the apt module) is?
I now have this code to get PostgreSQL's configdir on Debian:
- name: required packages for PostgreSQL
apt: name={{ item }} state=present
with_items:
- postgresql
- postgresql-client
- name: version of installed PostgeSQL server package
shell: dpkg-query -W --showformat='${Version}' postgresql | cut
--delimiter=+ --fields=1
register: pv
changed_when: False
- name: postgresql version
set_fact:
postgresql_version: "{{ pv.stdout }}"
- name: postgresql configdir
set_fact:
postgresql_configdir: "/etc/postgresql/{{ postgresql_version }}/main"
But I find the dpkg-query|cut a bit ugly. Is there a better way?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/0fdad73f-d531-4d80-be81-473db061f083%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.