From d0d33262cbdbc78678df5b496289aa29873eb3c4 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Fri, 2 Jun 2017 00:10:24 +0100 Subject: [PATCH] pkg5 with `latest` shouldn't ignore absent packages (#23006) When the state is set to `latest` we should install absent packages, not just upgrade already-instaled packages. This should fix #22823. --- lib/ansible/modules/packaging/os/pkg5.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/pkg5.py b/lib/ansible/modules/packaging/os/pkg5.py index 0aa3b4d836a..2cb2eba96f0 100644 --- a/lib/ansible/modules/packaging/os/pkg5.py +++ b/lib/ansible/modules/packaging/os/pkg5.py @@ -128,7 +128,9 @@ def ensure(module, state, packages, params): 'subcommand': 'install', }, 'latest': { - 'filter': lambda p: not is_latest(module, p), + 'filter': lambda p: ( + not is_installed(module, p) or not is_latest(module, p) + ), 'subcommand': 'install', }, 'absent': {