Skip to content

Commit

Permalink
ansible-pull by default will look for local.yml and $fqdn.yml.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mscherer committed Oct 13, 2013
1 parent b35337a commit 4b067fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/ansible-pull
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b067fa

Please sign in to comment.