Howto remove one apt package if the version differ
20 views
Skip to first unread message
J M
unread,
Sep 21, 2023, 2:31:12 PM9/21/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi,
I need to remove one apt package but only if differ the version, example should be:
- name: remove package
apt:
name:
- "htop!=2.2.0-2build1"
status: absent
Or something as:
- name: remove package
apt:
name:
- htop
status: absent
when: htop version != '2.2.0-2build1'
Howto write this task?
Regards
Brian Coca
unread,
Sep 21, 2023, 2:39:31 PM9/21/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
2 ways I can think of, first is use 'package_facts' to get the info
for version, the other is a shell task with something like `apt show
htop|grep Version|cut -f 2 -d':'`