2

I was trying to pass a bash script to cloud-init on rackspace-cloud with 'nova boot' via --user-data. I used the following command:

nova boot --key-name mykey1 --image "Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)"  --flavor general1-2  --user-data /tmp/tmpL3WNsB/cloudinit.sh qa-pro-24a

I can see the server qa-pro-24a created successfully. but the cloudinit.sh is not executed in the server created. the cloudinit.sh file was:

root@qa-master:/tmp/tmpL3WNsB# cat cloudinit.sh
#!/bin/bash

echo "192.168.4.8 net1" >> /etc/hosts
ufw allow ssh/tcp
ufw --force enable
Ajo Augustine
  • 1,262
  • 4
  • 16
  • 21

1 Answers1

0

You need to add --config-drive true to your parameters.

nova boot --config-drive true --user-data hello.sh --key-name rackspace --image "Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)" --flavor general1-2 qa-pro-24a

with this script

#!/bin/sh
echo "Hello World.  The time is now $(date -R)!" | tee /root/output.txt

and /root/output.txt was there waiting for me when I logged in.

Everett Toews
  • 663
  • 1
  • 6
  • 12