1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ansible-pull by default will look for local.yml and $fqdn.yml.

For a small network ( home, small company ), having to put the FQDN
in each file is a bit tedious, so this patch also add the shorthostname
as a 3rd default if the fqdn is not found.
This commit is contained in:
Michael Scherer 2013-10-13 11:20:47 +02:00
parent b35337a629
commit 4b067fa47e

View file

@ -80,10 +80,12 @@ def select_playbook(path, args):
return None
return playbook
else:
hostpb = "%s/%s.yml" % (path, socket.getfqdn())
fqdn = socket.getfqdn()
hostpb = "%s/%s.yml" % (path, fqdn)
shorthostpb = "%s/%s.yml" % (path, fqdn.split('.')[0])
localpb = "%s/%s" % (path, DEFAULT_PLAYBOOK)
errors = []
for pb in [hostpb, localpb]:
for pb in [hostpb, shorthostpb, localpb]:
rc = try_playbook(pb)
if rc == 0:
playbook = pb