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/4420/head
parent
b35337a629
commit
4b067fa47e
|
@ -80,10 +80,12 @@ def select_playbook(path, args):
|
||||||
return None
|
return None
|
||||||
return playbook
|
return playbook
|
||||||
else:
|
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)
|
localpb = "%s/%s" % (path, DEFAULT_PLAYBOOK)
|
||||||
errors = []
|
errors = []
|
||||||
for pb in [hostpb, localpb]:
|
for pb in [hostpb, shorthostpb, localpb]:
|
||||||
rc = try_playbook(pb)
|
rc = try_playbook(pb)
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
playbook = pb
|
playbook = pb
|
||||||
|
|
Loading…
Reference in New Issue