mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-29 16:11:22 -07:00
add repr for hostvars (#15793)
* allows passing full hostvars to a module
This commit is contained in:
parent
9e88fa21f5
commit
ddd9f92255
1 changed files with 6 additions and 0 deletions
|
@ -99,3 +99,9 @@ class HostVars(collections.Mapping):
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self._inventory.get_hosts(ignore_limits_and_restrictions=True))
|
return len(self._inventory.get_hosts(ignore_limits_and_restrictions=True))
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
out = {}
|
||||||
|
for host in self._inventory.get_hosts(ignore_limits_and_restrictions=True):
|
||||||
|
name = host.name
|
||||||
|
out[name] = self.get(name)
|
||||||
|
return repr(out)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue