diff --git a/changelogs/fragments/55505-foreman-inventory.yaml b/changelogs/fragments/55505-foreman-inventory.yaml new file mode 100644 index 0000000000..1248ee5a2c --- /dev/null +++ b/changelogs/fragments/55505-foreman-inventory.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Fix foreman inventory plugin when inventory caching is disabled diff --git a/lib/ansible/plugins/inventory/foreman.py b/lib/ansible/plugins/inventory/foreman.py index ebcdff9386..c7512ce98b 100644 --- a/lib/ansible/plugins/inventory/foreman.py +++ b/lib/ansible/plugins/inventory/foreman.py @@ -162,9 +162,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable): # get next page params['page'] += 1 - # Set the cache if it is enabled or if the cache was refreshed - if self.use_cache or self.get_option('cache'): - self._cache[self.cache_key][url] = results + self._cache[self.cache_key][url] = results return self._cache[self.cache_key][url]