Hello,

i'm playing with ovirt-ansible-roles for building a standard
configuration to be applied to all my ovirt setups.

I downloaded ovirt-ansible-roles 1.1.1 from github and unpacked
examples, playbooks and roles on a directory
(/ansible/ovirt-ansible-roles/).

I created then this playbook:

==8<==8<==8<==8<==8<== ovirt_infra.yml ==8<==8<==8<==8<==8<==8<===

---
- name: oVirt infra
  hosts: localhost
  connection: local
  gather_facts: false

  vars_files:
    - ovirt_infra_vars.yml
    - passwords.yml

  pre_tasks:
    - name: Login to oVirt
      ovirt_auth:
        url: "{{ engine_url }}"
        username: "{{ engine_user }}"
        password: "{{ engine_password }}"
        ca_file: "{{ engine_cafile | default(omit) }}"
        insecure: "{{ engine_insecure | default(true) }}"
      tags:
        - always
    - name: Generate Hosts list
      set_fact:
        hosts: "{{ hosts|default([]) + [ {'name': item.key, 'address':
item.key, 'cluster': item.value.cluster, 'password':
item.value.password|default('defaultpwd') } ] }}"
      with_dict: "{{ hosts_map }}"

  roles:
    - ovirt-infra

  post_tasks:
    - name: Logout from oVirt
      ovirt_auth:
        state: absent
        ovirt_auth: "{{ ovirt_auth }}"
      tags:
        - always

==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<===


file passwords.yml declares engine_password, ovirt_infra_vars.yml
instead contain this vars:

==8<==8<==8<==8<==8<==8<== ovirt_infra_vars.yml ==8<==8<==8<==8<==8<===

---
engine_url: https://ovirtengine.intranet.company/ovirt-engine/api
engine_user: admin@internal
engine_insecure: True

compatibility_version: 4.1

data_center_name: Default

hosts_map:
  fltiovirt001.intranet.company:
    cluster: production

clusters:
 - name: production
   cpu_type: Intel Westmere Family
   profile: production

==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<==8<===


I did some pre-flight checks and everything seems ok:

playbooks > ansible --version
ansible 2.4.0.0
  config file = /ansible/ovirt-ansible-roles/playbooks/ansible.cfg
  configured module search path =
[u'/home/remixtj/.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, May  3 2017, 07:55:04) [GCC 4.8.5
20150623 (Red Hat 4.8.5-14)]

playbooks > rpm -qa python-ovirt*
python-ovirt-engine-sdk4-4.1.6-1.el7ev.x86_64


So i hope that everything goes smooth, but...

playbooks > ansible-playbook ovirt_infra.yml
[DEPRECATION WARNING]: The use of 'include' for tasks has been
deprecated. Use 'import_tasks' for static inclusions or
'include_tasks' for dynamic
inclusions. This feature will be removed in a future release.
Deprecation warnings can be disabled by setting
deprecation_warnings=False in
ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but
usage is discouraged. The module documentation details page may
explain more
about this rationale.. This feature will be removed in a future
release. Deprecation warnings can be disabled by setting
deprecation_warnings=False
in ansible.cfg.

PLAY [oVirt infra]
***********************************************************************************************************************************

TASK [Login to oVirt]
********************************************************************************************************************************
ok: [localhost]

TASK [Generate Hosts list]
***************************************************************************************************************************
ok: [localhost] => (item={'key': u'fltiovirt001.intranet.company,
'value': {u'cluster': u'production'}})

TASK [ovirt-mac-pools : set mac pools]
***************************************************************************************************************

TASK [ovirt-datacenters : Add data center]
***********************************************************************************************************
An exception occurred during task execution. To see the full
traceback, use -vvv. The error was: Error: Failed to read response.
[DEPRECATION WARNING]: The 'ovirt_datacenters' module is being renamed
'ovirt_datacenter'. This feature will be removed in version 2.8.
Deprecation
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [localhost]: FAILED! => {"changed": false, "failed": true,
"msg": "Failed to read response."}

PLAY RECAP 
*******************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=1


If i run with -vvv i get this traceback and details when running the
task TASK [ovirt-datacenters : Add data center]

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_mmZ02F/ansible_module_ovirt_datacenters.py", line
215, in main
    ret = clusters_module.create()
  File "/tmp/ansible_mmZ02F/ansible_modlib.zip/ansible/module_utils/ovirt.py",
line 537, in create
    entity = self.search_entity(search_params)
  File "/tmp/ansible_mmZ02F/ansible_modlib.zip/ansible/module_utils/ovirt.py",
line 773, in search_entity
    entity = search_by_attributes(self._service,
name=self._module.params['name'])
  File "/tmp/ansible_mmZ02F/ansible_modlib.zip/ansible/module_utils/ovirt.py",
line 230, in search_by_attributes
    search=' and '.join('{}={}'.format(k, v) for k, v in kwargs.items())
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/services.py",
line 4453, in list
    return self._internal_get(headers, query, wait)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line
202, in _internal_get
    return future.wait() if wait else future
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/service.py", line
52, in wait
    response = self._connection.wait(self._context)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py",
line 460, in wait
    return self.__wait(context, failed_auth)
  File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py",
line 468, in __wait
    raise Error("Failed to read response.")
Error: Failed to read response.

[DEPRECATION WARNING]: The 'ovirt_datacenters' module is being renamed
'ovirt_datacenter'. This feature will be removed in version 2.8.
Deprecation
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
fatal: [localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "comment": null,
            "compatibility_version": "4.1",
            "description": null,
            "fetch_nested": false,
            "local": false,
            "mac_pool": null,
            "name": "Default",
            "nested_attributes": [],
            "poll_interval": 3,
            "quota_mode": null,
            "state": "present",
            "timeout": 180,
            "wait": true
        }
    },
    "msg": "Failed to read response."
}


What's wrong with the response?

The engine i want to manage is running oVirt Engine Version:
4.1.0.3-1.el7.centos

I can upgrade, but i'd like also to test the playbook for upgrading
the infrastructure...


Luca


-- 
"E' assurdo impiegare gli uomini di intelligenza eccellente per fare
calcoli che potrebbero essere affidati a chiunque se si usassero delle
macchine"
Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)

"Internet è la più grande biblioteca del mondo.
Ma il problema è che i libri sono tutti sparsi sul pavimento"
John Allen Paulos, Matematico (1945-vivente)

Luca 'remix_tj' Lorenzetto, http://www.remixtj.net , <lorenzetto.l...@gmail.com>
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users

Reply via email to