summaryrefslogtreecommitdiffstats
path: root/roles/local_deploy/files/ansible_run.sh
blob: 686907adee01b7b6a2f7bdccf9f1627c8937fc33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# script managed by ansible

cd /etc/ansible
for i in local $(hostname -s) $(hostname -f); do
    FILE=playbooks/${i}.yml
    [ -f $FILE ] && RESULT=$FILE
done

if [ -f /etc/ansible/requirements.yml ]; then
    /usr/bin/ansible-galaxy install -f -r /etc/ansible/requirements.yml
fi

if [ -n "$RESULT" ]; then
    ansible-playbook  -c local $RESULT
else
    echo "No playbook for this host found"
    exit 1
fi