Skip to content

Commit 282af94

Browse files
committed
use apt-cache policy to determined installed major version
1 parent 96af67a commit 282af94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tasks/install_package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
apt: name={{python_package_name}} update_cache=yes cache_valid_time=86400
1616

1717
- name: Get python version
18-
shell: "apt-cache show {{python_package_name}} | grep 'Version:' | awk '{print $2}' | cut -d. -f1"
18+
shell: "apt-cache policy {{python_package_name}} | grep 'Installed:' | awk '{print $2}' | cut -d. -f1"
1919
check_mode: no
2020
register: python_version_output
2121
changed_when: False #This just polls the system for information and doesn't change system information

0 commit comments

Comments
 (0)