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

echo " net1" >> /etc/hosts
ufw allow ssh/tcp
ufw --force enable

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

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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.