Thanks very much Matt! What you described was exactly what the situation was and your suggestion solved my problem!
Yes, I did have one vm called 'testvm2' already existed in my environment. I guess this vm was the culprit. Now I used a different name 'smallvm', and the vm creation was successful. Thanks again! -YuLing On Mon, Feb 3, 2014 at 11:23 AM, Matt Martz <[email protected]> wrote: > I doubt a log file will give you any additional information. > > I looked at nova_compute, and that error seems to occur in a specific > situation. > > The code does the following: > > 1) List all servers, passing a filter parameter to the API where it > filters based on the name you provided. > 2) If it get's a list of servers back, it iterates through them, > validating the name match > 3) It attempts to grab element 0 of the list of servers with that name > match > > In your case, it would appear the API is returning matches for 'vm2', but > then on further inspection, there are no name matches. > > Due to this "discrepancy" the module aborts. > > If you use 'novaclient' you should be able to test the name matching, by > performing a list such as: > > nova list --name vm2 > > I'm guessing what you find is that you have another server with a name > that starts or contains 'vm2' but doesn't exactly match vm2 such as vm22 or > such. > > In which case, you may want to look at giving your new server the name > "vm02" or similar. > > -- > Matt Martz > [email protected] > > On February 3, 2014 at 12:59:15 PM, YuLing Chen ([email protected]) > wrote: > > Hi All, > > I'm new in Ansible and looking at the OpenStack related modules in > ansible. All the modules worked pretty well in my environment except the > nova_compute module when I tried to create a VM instance. I was getting the > following error: > > PLAY [all] > ******************************************************************** > TASK: [create vm] > ************************************************************* > failed: [172.17.252.66] => {"failed": true} > msg: Error in getting the server list: list index out of range > FATAL: all hosts have already failed -- aborting > PLAY RECAP > ******************************************************************** > to retry, use: --limit @/root/yuling_nova_compute.retry > 172.17.252.66 : ok=0 changed=0 unreachable=0 > failed=1 > I was running an ansible playbook as follows: > [root@localhost test]# ansible-playbook -i hosts yuling_nova_compute.yml > Here is the playbook script: > --- > - hosts: all > #connection: all > gather_facts: False > vars: > var_true: True > var_false: False > var_empty_str: "''" > var_null: ~ > tasks: > - name: create vm > nova_compute: > name: vm2 > state: present > login_username: admin > login_password: d3ll1234 > login_tenant_name: admin > image_id: 3080841c-6e14-4063-a95d-06ce0f1b9e16 > auth_url: http://172.17.252.66:35357/v2.0/ > nics: > - net-id: 4eb9e68c-7d48-4913-bd59-c6ed34d6a9ed > security_groups: default > Any idea what could be wrong? Since I'm new to ansible, I'm not sure what > would be the best way for debugging the issue? I turned on -vvv, but didn't > see much more information. Is there any log file from ansible that would > show more detailed information? > > Thanks, > > YuLing > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
