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:
parent
b35337a629
commit
4b067fa47e
1 changed files with 4 additions and 2 deletions
|
@ -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…
Reference in a new issue