Creating a Cinder volume and attaching it to a Nova compute instance
Cinder provides a block storage mechanism, which is ideal to use with Nova for mounting disks. One disk volume is created when we create a Nova compute instance. However, often we need to attach multiple disk volumes to a compute instance. Cinder lets us create more volumes, and we can connect them to our compute instances.
How to do it…
Let's start by creating a 5 GB volume:
- name: create 5G test volume os_volume: state: present size: 5 display_name: data
The os_volume
module takes a size and a display name as parameters and creates a volume. This volume is not attached to the compute instance yet. We'll attach this volume to our webserver compute instance in the next task.
Let's go ahead and attach the volume created in the previous task to the webserver
compute instance that we created before:
- name: attach volume to host os_server_volume: state: present server: webserver volume: data
The preceding...