[ovirt-users] ovirt_nics problem at ansible module

Ondra Machacek omachace at redhat.com
Wed Mar 8 15:07:12 UTC 2017


On Wed, Mar 8, 2017 at 3:44 PM, Oğuz Yarımtepe <oguzyarimtepe at gmail.com>
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.
>

ovirt_nics module is part of the Ansible 2.3, and I guess you are using
Ansible 2.2. That's why it can't find the module.


>
> 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 }}"
>


This is a list of dictionary, so this should be:

nics:
  - name: "{{ nic_name }}"
    profile_name: "{{ profile_name }}"

(no second dash)


>
> without comments it works. Any idea? Any way to set the nic and profile
> via SDK? An example will be great.
>
> --
> Oğuz Yarımtepe
> http://about.me/oguzy
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20170308/f155ea36/attachment.html>


More information about the Users mailing list