[ovirt-users] Auto-restart VM from Linux Shell

Luca 'remix_tj' Lorenzetto lorenzetto.luca at gmail.com
Mon Mar 12 16:34:41 UTC 2018


Hello Andrei,

i'll do simply in this way with ansible:

- name: Start oVirt VMs
  hosts: localhost
  connection: local
  gather_facts: False

  tasks:

    - name: Obtain SSO token
      ovirt_auth:
          url: https://engine/ovirt-engine/api
          username: admin at internal
          password: password
          insecure: True
      ignore_errors: False

    - name: Stop VM
      ovirt_vms:
          state: stopped
          name: "server1"
          auth: "{{ ovirt_auth }}"

    - name: Start VM
      ovirt_vms:
          state: running
          name: "server1"
          auth: "{{ ovirt_auth }}"


    - always:
      - name: Revoke the SSO token
        ovirt_auth:
           state: absent
           ovirt_auth: "{{ ovirt_auth }}"

On Mon, Mar 12, 2018 at 11:04 AM,  <andreil1 at starlett.lv> wrote:
> You meant this:
> https://github.com/machacekondra/ovirt-ansible-example/wiki
> https://github.com/machacekondra/ovirt-ansible-example
>
> Seems like overkill for so simple task. If bash scripts works, its OK for now.
>
>
>> On 12 Mar 2018, at 11:31, Yedidyah Bar David <didi at redhat.com> wrote:
>>
>> On Mon, Mar 12, 2018 at 1:45 AM, Andrei Verovski <andreil1 at starlett.lv> wrote:
>>> Hi !
>>>
>>> I have stubborn VM which time to time freezes, and watchdog for whatever
>>> reason don't restart it.
>>>
>>> Basically I would like to combine these 3 command into one script.
>>>
>>> ovirt-shell -l https://node00.mydomain.com.lv/ovirt-engine/api
>>> --ca-file="/etc/pki/ovirt-engine/ca.pem" -u "admin at internal" --password
>>> "secret"
>>>
>>> action vm MyVM stop
>>> action vm MyVM start
>>>
>>> Now I have problems.
>>> 1) Option --password "secret" is not recognized anymore in oVirt Shell 4.2.
>>> 2) What is the proper syntax to connect & run certain command in oVirt
>>> Shell 4.2? Something like:
>>>
>>> ovirt-shell -l https://node00.mydomain.com.lv/ovirt-engine/api
>>> --ca-file="/etc/pki/ovirt-engine/ca.pem" -u "admin at internal" --password
>>> "secret" && action vm MyVM stop
>>
>> ovirt-shell is considered deprecated. Did you consider using ansible?
>>
>> Best regards,
>> --
>> Didi
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users



-- 
"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.luca at gmail.com>


More information about the Users mailing list