Wednesday, March 4, 2015

Image and openstack : how to get a centos7 image and change its credentials?

So I wanted  to create vms with centos7 on it so the steps I thought i would take was

$ nova boot --flavor FLAVOR_ID --image IMAGE_ID --key-name KEY_NAME \
  --user-data USER_DATA_FILE --security-groups SEC_GROUP_NAME --meta KEY=VALUE \
  INSTANCE_NAME

Now it seemed logical to look for IMAGE_ID in

$ nova image-list  
$glance  image-list

But the catch is centos image was not there

you can find it here :-

http://cloud.centos.org/centos/7/images/

$glance image-create imageName --location IMAGE_URL

Now go ahead get the image-id and create a vm as specified above.

Next thing you will run into is credentials. How do i log into the box ( lets say if you can not ssh for some reason into it)

Cloudinit comes to rescue a simple
mydata.file

$ nova boot --image ubuntu-cloudimage --flavor 1 --user-data mydata.file
mydata.file will look like this
#cloud-config
password: yourpwd
chpasswd: { expire: False }
ssh_pwauth: True


Now you can loginto your box with these credentials
 username:centos
 password:yourpwd










 



No comments:

Post a Comment