#!/bin/sh cd /etc/ansible for i in local $(hostname -s) $(hostname -f); do FILE=playbooks/${i}.yml [ -f $FILE ] && RESULT=$FILE done if [ -n $RESULT ]; then ansible-playbook -c local $RESULT else echo "No playbook for this host found" exit 1 fi