From 4b067fa47ec8883b8dc528f50486808ceb3d69f1 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sun, 13 Oct 2013 11:20:47 +0200 Subject: 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. --- bin/ansible-pull | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/ansible-pull b/bin/ansible-pull index 4e1ff7e646..66782969c5 100755 --- a/bin/ansible-pull +++ b/bin/ansible-pull @@ -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 -- cgit v1.2.1 From 92147aff0ff1c886eea2cfb48007fd1c41e46871 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sun, 13 Oct 2013 11:42:09 +0200 Subject: also fix the doc, forgot in last commit --- bin/ansible-pull | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/ansible-pull b/bin/ansible-pull index 66782969c5..9f340bb349 100755 --- a/bin/ansible-pull +++ b/bin/ansible-pull @@ -32,8 +32,9 @@ # for playbooks in the following order, stopping at the first match: # # 1. $workdir/path/playbook.yml, if specified -# 2. $workdir/$hostname.yml -# 3. $workdir/local.yml +# 2. $workdir/$fqdn.yml +# 3. $workdir/$hostname.yml +# 4. $workdir/local.yml # # the source repo must contain at least one of these playbooks. -- cgit v1.2.1