Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: clear_facts #14971

Merged
merged 1 commit into from
Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/ansible/plugins/strategy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ def _execute_meta(self, task, play_context, iterator):
self.run_handlers(iterator, play_context)
elif meta_action == 'refresh_inventory':
self._inventory.refresh_inventory()
elif meta_action == 'clear_facts':
for host in iterator._host_states:
self._variable_manager.clear_facts(host)
#elif meta_action == 'reset_connection':
# connection_info.connection.close()
elif meta_action == 'clear_host_errors':
Expand Down
7 changes: 7 additions & 0 deletions lib/ansible/vars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,13 @@ def add_group_vars_file(self, path, loader):
else:
return dict()

def clear_facts(self, hostname):
'''
Clears the facts for a host
'''
if hostname in self._fact_cache:
del self._fact_cache[hostname]

def set_host_facts(self, host, facts):
'''
Sets or updates the given facts for a host in the fact cache.
Expand Down