From 94d44e879195c8665141f129ea2f8077e33df0b4 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 21 Sep 2017 16:21:29 -0400 Subject: [PATCH] disable GCE inventory source cache by default, the GCE inventory script caches results on disk for 5 minutes; disable this behavior see: https://github.com/ansible/ansible-tower/issues/7609 --- awx/main/management/commands/inventory_import.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 9959001bf8..c84d12c16c 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -176,6 +176,13 @@ class AnsibleInventoryLoader(object): def load(self): base_args = self.get_base_args() logger.info('Reading Ansible inventory source: %s', self.source) + + # by default, the GCE inventory source caches results on disk for + # 5 minutes; disable this behavior + # https://github.com/ansible/tower/blob/cfb633e8a643b0190fa07b6204b339a1d336cbb3/awx/plugins/inventory/gce.py#L115 + if self.source.endswith('gce.py'): + base_args += ['--refresh-cache'] + data = self.command_to_json(base_args + ['--list']) # TODO: remove after we run custom scripts through ansible-inventory