[ovirt-users] ansible ovirt-vms

Norman Lamponi norman.lamponi at gmail.com
Thu Feb 23 15:04:17 UTC 2017


Many thanks Juan, now works fine, i spend 3 days on this reading docs.


Norman

On Thu, Feb 23, 2017 at 2:26 PM, Juan Hernández <jhernand at redhat.com> wrote:

> On 02/23/2017 01:58 PM, Norman Lamponi wrote:
> > Hello all,
> >
> > i'm trying to implement automatic deploy of vm on a rhevm/ovirt platform
> > using ansible and ovirt_vms module.
> >
> > I take rhel 7.3 kvm guest with cloud init like template, i can deploy vm
> > with no problem but when i try using ansible to power up and configure
> > it with cloud init the process fail.
> >
> > My playbook is this:
> > ---
> > - hosts: ovirt
> >   tasks:
> >     - name: Parti e configura
> >       ovirt_vms:
> >           auth:
> >             username: admin at internal
> >             password: xxxxxxxx
> >             url: https://webaddress/ovirt-engine
>
> Try to add /api to the 'url' parameter.
>
> >             ca_file: /etc/pki/ovirt-engine/ca.pem
> >           name: rh7conf
> >           cluster: Sviluppo
> >           high_availability: true
> >           cloud_init:
> >             nic_boot_protocol: static
> >             nic_ip_address: 10.x.xx.xxx
> >             nic_netmask: 255.255.252.0
> >             nic_gateway: 10.x.xx.xxx
> >             nic_name: eth0
> >             nic_on_boot: true
> >             host_name: sticameca
> >             user_name: root
> >             root_password: stapera
> >
> > my host file is:
> > [ovirt]
> > webaddress ansible_user=root
> >
> > and  error is:
> >
> > nsible-playbook -i ~/ansible/ovirt_hosts orig.testovirt_vms.yml -vvvv
> > Using /etc/ansible/ansible.cfg as config file
> > Loading callback plugin default of type stdout, v2.0 from
> > /usr/lib/python2.7/dist-packages/ansible/plugins/callback/__init__.pyc
> >
> > PLAYBOOK: orig.testovirt_vms.yml
> > ***********************************************
> > 1 plays in orig.testovirt_vms.yml
> >
> > PLAY [ovirt]
> > *******************************************************************
> >
> > TASK [setup]
> > *******************************************************************
> > Using module file
> > /usr/lib/python2.7/dist-packages/ansible/modules/core/system/setup.py
> > <webaddress> ESTABLISH SSH CONNECTION FOR USER: root
> > <webaddress> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r
> > webaddress'/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo
> > ~/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084 `" && echo
> > ansible-tmp-1487853056.88-81930174841084="` echo
> > ~/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084 `" ) && sleep
> > 0'"'"''
> > <webaddress> PUT /tmp/tmp0wuXiN TO
> > /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/setup.py
> > <webaddress> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r
> '[webaddress]'
> > <webaddress> ESTABLISH SSH CONNECTION FOR USER: root
> > <webaddress> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r
> > webaddress'/bin/sh -c '"'"'chmod u+x
> > /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/
> > /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/setup.py &&
> > sleep 0'"'"''
> > <webaddress> ESTABLISH SSH CONNECTION FOR USER: root
> > <webaddress> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r -tt
> > webaddress'/bin/sh -c '"'"'/usr/bin/python
> > /root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/setup.py; rm
> > -rf "/root/.ansible/tmp/ansible-tmp-1487853056.88-81930174841084/" >
> > /dev/null 2>&1 && sleep 0'"'"''
> > ok: [webaddress]
> >
> > TASK [Parti e configura]
> > *******************************************************
> > task path: /home/lamponin/ansible/playbook/orig.testovirt_vms.yml:4
> > Using module file
> > /usr/lib/python2.7/dist-packages/ansible/modules/
> extras/cloud/ovirt/ovirt_vms.py
> > <webaddress> ESTABLISH SSH CONNECTION FOR USER: root
> > <webaddress> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/lamponin/.ansible/cp/ansible-ssh-%h-%p-%r
> > webaddress'/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo
> > ~/.ansible/tmp/ansible-tmp-1487853058.27-257942678666870 `" && echo
> > ansible-tmp-1487853058.27-257942678666870="` echo
> > ~/.ansible/tmp/ansible-tmp-1487853058.27-257942678666870 `" ) && sleep
> > 0'"'"''
> > <webaddress> PUT /tmp/tmphQzpox TO
> > /root/.ansible/tmp/ansible-tmp-1487853058.27-
> 257942678666870/ovirt_vms.py
> > <webaddress> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/utente/.ansible/cp/ansible-ssh-%h-%p-%r '[webaddress]'
> > <webaddress> ESTABLISH SSH CONNECTION FOR USER: root
> > <webaddress> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/utente/.ansible/cp/ansible-ssh-%h-%p-%r
> > webaddress'/bin/sh -c '"'"'chmod u+x
> > /root/.ansible/tmp/ansible-tmp-1487853058.27-257942678666870/
> > /root/.ansible/tmp/ansible-tmp-1487853058.27-257942678666870/ovirt_vms.py
> &&
> > sleep 0'"'"''
> > <webaddress> ESTABLISH SSH CONNECTION FOR USER: root
> > <webaddress> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o
> > ControlPersist=60s -o KbdInteractiveAuthentication=no -o
> > PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
> -o
> > PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o
> > ControlPath=/home/utente/.ansible/cp/ansible-ssh-%h-%p-%r -tt
> > webaddress'/bin/sh -c '"'"'/usr/bin/python
> > /root/.ansible/tmp/ansible-tmp-1487853058.27-
> 257942678666870/ovirt_vms.py;
> > rm -rf "/root/.ansible/tmp/ansible-tmp-1487853058.27-257942678666870/" >
> > /dev/null 2>&1 && sleep 0'"'"''
> > fatal: [webaddress]: FAILED! => {
> >     "changed": false,
> >     "failed": true,
> >     "invocation": {
> >         "module_args": {
> >             "boot_devices": null,
> >             "cd_iso": null,
> >             "clone": false,
> >             "clone_permissions": false,
> >             "cloud_init": {
> >                 "host_name": "sticameca",
> >                 "nic_boot_protocol": "static",
> >                 "nic_gateway": "10.x.xx.xxx",
> >                 "nic_ip_address": "10.x.xx.xxx",
> >                 "nic_name": "eth0",
> >                 "nic_netmask": "255.255.252.0",
> >                 "nic_on_boot": true,
> >                 "root_password": "stapera",
> >                 "user_name": "root"
> >             },
> >             "cluster": "Sviluppo",
> >             "cpu_cores": null,
> >             "cpu_shares": null,
> >             "cpu_sockets": null,
> >             "delete_protected": null,
> >             "disks": [],
> >             "force": false,
> >             "high_availability": true,
> >             "host": null,
> >             "id": null,
> >             "memory": "1GiB",
> >             "memory_guaranteed": null,
> >             "name": "rh7conf",
> >             "nics": [],
> >             "operating_system": null,
> >             "poll_interval": 3,
> >             "state": "present",
> >             "stateless": null,
> >             "sysprep": null,
> >             "template": "kvm73cloudinit",
> >             "timeout": 180,
> >             "type": null,
> >             "wait": true
> >         },
> >         "module_name": "ovirt_vms"
> >     },
> >     "msg": "Can't move to the next element"
> > }
> > to retry, use: --limit @/home/xxxx/ansible/playbook/
> orig.testovirt_vms.retry
> >
> > PLAY RECAP
> > *********************************************************************
> > webaddress           : ok=1    changed=0    unreachable=0    failed=1
> >
> > My cm is an ubuntu server (but test centos and rhel too)
> > Description:Ubuntu 16.10
> > Release:16.10
> > Codename:yakkety
> >
> > lamponin at ubuntu:~/ansible/playbook$ pip list | grep ovirt
> > DEPRECATION: The default format will switch to columns in the future.
> > You can use --format=(legacy|columns) (or define a
> > format=(legacy|columns) in your pip.conf under the [list] section) to
> > disable this warning.
> > ovirt-engine-sdk-python (4.1.0)
> > lamponin at ubuntu:~/ansible/playbook$ dpkg -l | grep python2
> > ii  idle-python2.7                             2.7.12-3build1
> >                         all          IDE for Python (v2.7) using Tkinter
> > ii  libpython2.7:amd64                         2.7.12-3build1
> >                         amd64        Shared Python runtime library
> > (version 2.7)
> > ii  libpython2.7-dev:amd64                     2.7.12-3build1
> >                         amd64        Header files and a static library
> > for Python (v2.7)
> > ii  libpython2.7-minimal:amd64                 2.7.12-3build1
> >                         amd64        Minimal subset of the Python
> > language (version 2.7)
> > ii  libpython2.7-stdlib:amd64                  2.7.12-3build1
> >                         amd64        Interactive high-level
> > object-oriented language (standard library, version 2.7)
> > ii  python2.7                                  2.7.12-3build1
> >                         amd64        Interactive high-level
> > object-oriented language (version 2.7)
> > ii  python2.7-dev                              2.7.12-3build1
> >                         amd64        Header files and a static library
> > for Python (v2.7)
> > ii  python2.7-minimal                          2.7.12-3build1
> >                         amd64        Minimal subset of the Python lan
> >
> >
> >
> > Best regards Norman
> >
> >
> > _______________________________________________
> > 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/20170223/627a6a41/attachment-0001.html>


More information about the Users mailing list