docker: provide alternatives to ansible_facts results (#51192)

* Try to stop using ansible_facts for docker modules.

* Stop using facts returned from regular modules.
This commit is contained in:
Felix Fontein 2019-02-18 14:41:34 +01:00 committed by John R Barker
parent 8222ebd23a
commit 37b0f5c81b
7 changed files with 50 additions and 26 deletions

View file

@ -246,8 +246,11 @@ EXAMPLES = '''
'''
RETURN = '''
facts:
description: Network inspection results for the affected network.
docker_network:
description:
- Network inspection results for the affected network.
- Note that facts are part of the registered vars since Ansible 2.8. For compatibility reasons, the facts
are also accessible directly.
returned: success
type: dict
sample: {}
@ -575,7 +578,9 @@ class DockerNetworkManager(object):
if not self.check_mode and not self.parameters.debug:
self.results.pop('actions')
self.results['ansible_facts'] = {u'docker_network': self.get_existing_network()}
network_facts = self.get_existing_network()
self.results['ansible_facts'] = {u'docker_network': network_facts}
self.results['docker_network'] = network_facts
def absent(self):
self.diff_tracker.add('exists', parameter=False, active=self.existing_network is not None)