forked from vyos-legacy/build-ami
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vyos-build-ami
executable file
·44 lines (31 loc) · 1.17 KB
/
vyos-build-ami
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# vyos-build-ami.sh: ansible-playbook wrapper for vyos-build-ami project
# Copyright 2018 VyOS maintainers and contributors <maintainers@vyos.net>
# Portions copyright 2014 hydrajump <wave@hydrajump.com>
# Distributed under the terms of the MIT license
# Playbooks are located in 'playbooks/' directory by default and have an .yml
# extension.
# Check dependencies
which aws 2>&1 >/dev/null
if [ $? -ne 0 ]; then
echo "awscli is not installed or is not in your $PATH"
exit 1
fi
which ansible 2>&1 >/dev/null
if [ $? -ne 0 ]; then
echo "ansible is not installed or is not in your $PATH"
exit 1
fi
# Get arguments
if [ $# -lt 1 ]; then
echo "Usage: $0 <ISO URL>"
exit 1
fi
ISO_URL=$1
# Allow boto (2) to connect to new regions that aren't built-in
# (see https://github.com/boto/boto/issues/3783#issuecomment-422990383)
export BOTO_USE_ENDPOINT_HEURISTICS=True
# Do the job
cd $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
ANSIBLE_ARGS="-e iso=$ISO_URL --skip-tags verify"
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook playbooks/vyos-build-ami.yml -vvv -i hosts --private-key=playbooks/files/ssh-keys/vyos-build-ami.pem $ANSIBLE_ARGS $2