~dvshkn/scripts

ref: 1a62835f3fc98d9d09d379213ae8ddecb806a62e scripts/run_playbook.sh -rwxr-xr-x 403 bytes
1a62835fDavid Knight add setup_new_droplet.yml playbook 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
#
# Script to run an Ansible playbook on a specific host.
# 
# Usage: ./run_playbook.sh [playbook yml] [host ip/name]
#

if [[ -z $2 ]]; then
    echo "Usage: ./run_playbook.sh [playbook yml] [host ip/name]"
fi

PLAYBOOK_PATH=$1
HOST=$2

rm -f .ansible_hosts.tmp

echo "[ip_addr]" > .ansible_hosts.tmp
echo "$HOST" >> .ansible_hosts.tmp

ansible-playbook $PLAYBOOK_PATH -i .ansible_hosts.tmp