forked from codygreen/terraform-aws-bigip-demo
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathjumphost.userdata.tmpl
31 lines (23 loc) · 938 Bytes
/
jumphost.userdata.tmpl
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
#!/bin/bash
# Script must be non-blocking or run in the background for use in user_data.
mkdir -p /config/cloud
cat << 'EOF' > /config/cloud/startup-script.sh
#!/bin/bash
# prevent prompting for restart when installing core packages such as libssl
DEBIAN_FRONTEND=noninteractive
echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
# install dependencies
sudo apt update
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install software-properties-common ansible python-apt python-pip rpm -y
sudo pip install -q jmespath
# install inspec
sudo apt install wget
wget https://packages.chef.io/files/stable/inspec/4.18.0/ubuntu/18.04/inspec_4.18.0-1_amd64.deb
sudo dpkg -i inspec_4.18.0-1_amd64.deb
### Clean up
rm /config/cloud/startup-script.sh
EOF
# Now run in the background to not block startup
chmod 755 /config/cloud/startup-script.sh
nohup /config/cloud/startup-script.sh &