Ansible and openstack questions

Hi all!

I am trying to use the nova_compute plugin and keep on getting:

ERROR: nova_compute is not a legal parameter in an Ansible Playbook

ansible-doc, if I run it, shows that the module is there as well as looking in /usr/share/ansible/cloud/ (nova_compute is there). This is ansible 1.5.3.

I’m using the example found in the actual documentation:

  • nova_compute:
    state: present
    login_username: xxx

login_password: xxx
login_tenant_name: xxx-project1
name: vm1
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/tokens
region_name: region-b.geo-1
image_id: 9302692b-b787-4b52-a3a6-daebb79cb498
key_name: test
wait_for: 200
flavor_id: 101
security_groups: default
nics:

  • net-id: 7da74520-9d5e-427b-a508-213c84e69616

So, what else does one need here? I simply want to get familiar with using this to launch instances and then manage them. Is there any simplified document that demonstrates this?

Regards and thank you!

Patrick

Can we see this in the full playbook context?

Thanks Michael,

I actually found a bug (region wasn’t being supplied to nova client “Client()”) in the code and submitted a pull request to the nova_compute driver. My very simplistic example that now works with my fix, using HP Cloud, is the following:

# Creates a new VM and attaches to a network and passes metadata to the instance
- name: launch a nova instance
  hosts: localhost
  tasks:
  - name: launch an instance
    nova_compute:
      state: present
      login_username: myuser
      login_password: xxxx
      login_tenant_name: myuser-project1
      name: vm1
      auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
      region_name: region-b.geo-1
      image_id: 9302692b-b787-4b52-a3a6-daebb79cb498
      key_name: test
      wait_for: 200
      flavor_id: 101
      security_groups: default
      

Yep, saw your ticket – thanks.

Some testing on this to make sure it doesn’t break normalish OpenStack while fixing your case might be welcome if possible, should someone want to give it a shot.

It’s not clear what the resolution here was. I’m getting the same error with the latest master branch.

Did you mean “nova_compute is not a valid…”.

Sounds like you have an indentation error in your playbook possibly, can you show an example?