nova_compute - Create/Delete VMs from OpenStack

Synopsis

New in version 1.2.

Create or Remove virtual machines from Openstack.

Options

parameter required default choices comments
auth_url no http://127.0.0.1:35357/v2.0/
    The keystone url for authentication
    flavor_id no 1
      The id of the flavor in which the new VM has to be created
      image_id yes None
        The id of the image that has to be cloned
        key_name no None
          The key pair name to be used when creating a VM
          login_password yes yes
            Password of login user
            login_tenant_name yes yes
              The tenant name of the login user
              login_username yes admin
                login username to authenticate to keystone
                meta no None
                  A list of key value pairs that should be provided as a metadata to the new VM
                  name yes None
                    Name that has to be given to the instance
                    nics no None
                      A list of network id's to which the VM's interface should be attached
                      region_name no None
                        Name of the region
                        security_groups no None
                          The name of the security group to which the VM should be added
                          state no present
                          • present
                          • absent
                          Indicate desired state of the resource
                          wait no yes
                            If the module should wait for the VM to be created.
                            wait_for no 180
                              The amount of time the module should wait for the VM to get into active state

                              Note

                              Requires novaclient

                              Examples


                              # Creates a new VM and attaches to a network and passes metadata to the instance
                              - nova_compute:
                                     state: present
                                     login_username: admin
                                     login_password: admin
                                     login_tenant_name: admin
                                     name: vm1
                                     image_id: 4f905f38-e52a-43d2-b6ec-754a13ffb529
                                     key_name: ansible_key
                                     wait_for: 200
                                     flavor_id: 4
                                     nics:
                                       - net-id: 34605f38-e52a-25d2-b6ec-754a13ffb723
                                     meta:
                                       hostname: test1
                                       group: uge_master