
Hello, I think it's just a typo. Try renaming "ovirt_vms_facts" to "ovirt_vm_facts". This worked for me: - hosts: localhost gather_facts: no tasks: - name: Login to oVirt ovirt_auth: url: https://<engine_fqdn>/ovirt-engine/api username: admin@internal password: <pass> insecure: yes - name: Gather info on all the virtual machines ovirt_vm_facts: auth: "{{ ovirt_auth }}" pattern: "cluster=Default" # Get VMs from cluster "Default" - name: Print the gathered info debug: var: ovirt_vms Or better yet, use directly "ovirt_vm_info" like this. Note that when using "ovirt_vm_info", you need to *register* the output in a variable. - hosts: localhost gather_facts: no tasks: - name: Login to oVirt ovirt_auth: url: https://<engine_fqdn>/ovirt-engine/api username: admin@internal password: <pass> insecure: yes - name: Gather info on all the virtual machines ovirt_vm_info: auth: "{{ ovirt_auth }}" pattern: "cluster=Default" # Get VMs from cluster "Default" register: vms - name: Print the gathered info debug: var: vms.ovirt_vms I believe that not being able to see documentation for "ovirt_vm_facts" in *ansible-doc* command is an intention. Best regards Jan On Thu, Dec 19, 2019 at 9:37 AM <csyeow@gmail.com> wrote:
Hi Martin
thanks for your information.
but when i try on one of my testlab RHV 4.3 farm, ansible 2.9 complain that ovirt_vm_facts not found, detail refer to below command output
based on RHV 4.3 ansible version as below:
# ansible --version ansible 2.9.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
# ansible-doc --list | egrep -i ovirt_vm --> not showing ovirt_vm_facts module [WARNING]: win_template parsing did not produce documentation. [WARNING]: template parsing did not produce documentation. ovirt_vm_info Retrieve information about one or more oVirt/RHV virtual machines ovirt_vmpool Module to manage VM pools in oVirt/RHV ovirt_vmpool_info Retrieve information about one or more oVirt/RHV vmpools ovirt_vm Module to manage Virtual Machines in oVirt/RHV [root@rhvm100 ~]#
#### use ovirt_vms_facts module # cat list_vms01.yml - hosts: localhost connection: local vars_files: - engine_vars.yml - password.yml
tasks: - name: Obtain SSO token ovirt_auth: url: "{{ engine_url }}" username: "{{ engine_user }}" password: "{{ engine_password }}" ca_file: "{{ engine_cafile | default(omit) }}" # insecure: "{{ engine_insecure }}"
- name: List vms ovirt_vms_facts: fetch_nested: true nested_attributes: - description auth: "{{ ovirt_auth }}"
- name: set vms set_fact: vm: "{{ item.name }}: {{ item.snapshots | map(attribute='description') | join(',') }}" with_items: "{{ ovirt_vms }}" loop_control: label: "{{ item.name }}" register: all_vms
- name: make a list set_fact: vms="{{ all_vms.results | map(attribute='ansible_facts.vm') | list }}"
- name: Print vms debug: var: vms
# ansible-playbook list_vms01.yml --syntax-check [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! couldn't resolve module/action 'ovirt_vms_facts'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/root/rhv_ansible/list_vms01.yml': line 16, column 5, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: List vms ^ here
thanks _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/TUTNDLLOMOWX6R...
-- Jan Zmeskal Quality Engineer, RHV Core System Red Hat <https://www.redhat.com> <https://www.redhat.com>