-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExercise 5 - userdata
More file actions
36 lines (23 loc) · 925 Bytes
/
Exercise 5 - userdata
File metadata and controls
36 lines (23 loc) · 925 Bytes
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
# Create the user-data script
cat > ~/user-data.txt <<EOF
#!/bin/sh
echo "Hello World. The time is now $(date -R)!" | tee /home/cirros//output.txt
EOF
# Create a new instance with the user-data
openstack server create --image CirrOS --flavor m1.tiny --key_name test --user_data ~/user-data.txt MY_USER_DATA_VM
openstack server list
> /home/stack/.ssh/known_hosts
ipaddress=... # Get IP address from nova list
ssh -i test.pem cirros@$ipaddress
cat output.txt
curl http://169.254.169.254/
curl http://169.254.169.254/latest
curl http://169.254.169.254/latest/user-data
exit
# Nova-network configures iptables to NAT port 80 of 169.254.169.254 to the $my-ip
sudo iptables -L -n -t nat | grep 169
# my_ip address is specified in /etc/nova/nova.conf
cat /etc/nova/nova.conf | grep my_ip
# meta-data api is running on the api server
cat /etc/nova/nova.conf | grep enabled_apis
openstack server delete MY_USER_DATA_VM