Feature/add ansible play hosts all (#17498)

* refactor ignore_limits_and_restrictions

into ignore_limits and ignore_limitations

* add ansible_play_hosts_all

* update docs re ansible_play_hosts_all

* only use play.hosts when is has a value

* replace ansible_play_hosts with ansible_play_hosts_all

* remove unnecessary var
This commit is contained in:
j0hnsmith 2016-09-23 16:17:46 +01:00 committed by Brian Coca
parent 52bf021904
commit 4650d8910e
5 changed files with 24 additions and 27 deletions

View file

@ -413,9 +413,8 @@ class VariableManager:
# DEPRECATED: play_hosts should be deprecated in favor of ansible_play_hosts,
# however this would take work in the templating engine, so for now
# we'll add both so we can give users something transitional to use
host_list = [x.name for x in self._inventory.get_hosts()]
variables['play_hosts'] = host_list
variables['ansible_play_hosts'] = host_list
variables['play_hosts'] = [x.name for x in self._inventory.get_hosts()]
variables['ansible_play_hosts'] = [x.name for x in self._inventory.get_hosts(pattern=play.hosts or 'all', ignore_restrictions=True)]
# the 'omit' value alows params to be left out if the variable they are based on is undefined
variables['omit'] = self._omit_token
@ -490,7 +489,7 @@ class VariableManager:
if delegated_host_name in C.LOCALHOST:
delegated_host = self._inventory.localhost
else:
for h in self._inventory.get_hosts(ignore_limits_and_restrictions=True):
for h in self._inventory.get_hosts(ignore_limits=True, ignore_restrictions=True):
# check if the address matches, or if both the delegated_to host
# and the current host are in the list of localhost aliases
if h.address == delegated_host_name: