[ovirt-users] ovirt_nics problem at ansible module

Juan Hernández jhernand at redhat.com
Wed Mar 8 14:57:15 UTC 2017


On 03/08/2017 03:44 PM, Oğuz Yarımtepe wrote:
> Hi,
> 
> Below is my playbook
> 
> ---
> - name: Setup oVirt environment
>   hosts: vms
>   tasks:
>     - block:
>         - name: Include oVirt password
>           #no_log: true
>           include_vars: vars.yml
> 
>         - name: Obtain SSO token
>           no_log: true
>           ovirt_auth:
>             url: "{{ url }}"
>             username: "{{ username }}"
>             password: "{{ password }}"
>             ca_file: "{{ ca_file }}"
> 
>         - name: Create and run VM from template
>           ovirt_vms:
>             auth: "{{ ovirt_auth }}"
>             name: "{{ vm }}"
>             template: "{{ template }}"
>             cluster: "{{ cluster }}"
>             memory: "{{ memory }}"
>             memory_guaranteed: "{{ memory_guaranteed }}"
>             high_availability: true
>             cpu_cores: "{{ cpu_cores }}"
>             cpu_sockets: "{{ cpu_sockets }}"
>             type: server
>             name: "{{ vm }}"
>             operating_system: other_linux
>             state: stopped
>             wait: yes
> 
>         #- name: Add nic
>         #  ovirt_nics:
>         #    auth: "{{ ovirt_auth }}"
>         #    name: "{{ nic_name }}"
>         #    profile: "{{ profile_name }}"
>         #    state: plugged
>         #    vm: "{{ vm }}"
>         #    wait: yes
> 
>       always:
>         - name: Revoke the SSO token
>           ovirt_auth:
>             state: absent
>             ovirt_auth: "{{ ovirt_auth }}"
> 
> When i remove the commented lines here is what i got:
> 
> ERROR! no action detected in task. This often indicates a misspelled
> module name, or incorrect module path.
> 
> The error appears to have been in
> '/Users/oyarimtepe/test/ovirt-ansible/create_vm_from_template/playbook.yml':
> line 35, column 11, but may
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
> 
>         - name: Add nic
>           ^ here
> 
> 
> The error appears to have been in
> '/Users/oyarimtepe/test/ovirt-ansible/create_vm_from_template/playbook.yml':
> line 35, column 11, but may
> be elsewhere in the file depending on the exact syntax problem.
> 
> The offending line appears to be:
> 
> 
>         - name: Add nic
>           ^ here
> 
> I tried using the nics attribute of ovirt_vms module but this time i got
> Nic[Name] is required although i defined as below:
> 
> nics:
>   - name: "{{ nic_name }}"
>   - profile_name: "{{ profile_name }}"
> 
> without comments it works. Any idea? Any way to set the nic and profile
> via SDK? An example will be great.
> 

If what you are looking for is a way to add a NIC to an existing VM,
using a specific vNIC profile, you can use this example:


https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/add_vm_nic.py



More information about the Users mailing list