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.
pull/4484/head
Michael Scherer 11 years ago
parent b35337a629
commit 4b067fa47e

@ -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

Loading…
Cancel
Save