poweroff and reboot with ovirt_vm ansible module

Hello, is there a way to poweroff or reboot (without stopped and running state) a vm with the ovirt_vm ansible module? -- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

hi, AFAIK, setting state=stopped is the only way to poweroff a VM. While to reboot a VM, you could also follow the steps below: 1. Update a VM with some new properties that requires a restart operation, also with the param: next_run=true 2. Set state=next_run in your playbook and apply it Then the VM could reboot automatically. On Sat, Nov 3, 2018 at 1:19 AM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello, is there a way to poweroff or reboot (without stopped and running state) a vm with the ovirt_vm ansible module?
-- Nathanaël Blanchet
Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr _______________________________________________ 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/EBJOTJJKW3TGI6...

Joey is right, we don't such functionality. But feel free to open an issue here[1] and we can implement it. [1] https://github.com/ansible/ansible/issues On 11/3/18 1:10 AM, Joey Ma wrote:
hi,
AFAIK, setting state=stopped is the only way to poweroff a VM. While to reboot a VM, you could also follow the steps below: 1. Update a VM with some new properties that requires a restart operation, also with the param: next_run=true 2. Set state=next_run in your playbook and apply it
Then the VM could reboot automatically.
On Sat, Nov 3, 2018 at 1:19 AM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello, is there a way to poweroff or reboot (without stopped and running state) a vm with the ovirt_vm ansible module?
-- Nathanaël Blanchet
Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr _______________________________________________ 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/EBJOTJJKW3TGI6...
_______________________________________________ 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/L5PEO3WOODJIB2...

Hello, sorry if I continue in this thread but I have the same issue. This solution in my case doesn't work and the VM can't reboot after an update task like this - name: Set next_run ovirt_vm: next_run: yes name: "{{ item.name }}" auth: "{{ ovirt_auth }}" wait: true with_items: - "{{ vm_result.ovirt_vms }}" ignore_errors: true - name: Change state in next_run and reboot ovirt_vm: name: "{{ item.name }}" auth: "{{ ovirt_auth }}" state: next_run wait: true boot_devices: - hd with_items: - "{{ vm_result.ovirt_vms }}" ignore_errors: true What's wrong? Thank you!

Hi, the info is not enough. Can you provide the error you receive.Most probably you will need to enable some debug to identify the issue. Best Regards,Strahil Nikolov On Fri, May 14, 2021 at 12:44, Alessio B.<alessio.battaglia.1981@gmail.com> wrote: Hello, sorry if I continue in this thread but I have the same issue. This solution in my case doesn't work and the VM can't reboot after an update task like this - name: Set next_run ovirt_vm: next_run: yes name: "{{ item.name }}" auth: "{{ ovirt_auth }}" wait: true with_items: - "{{ vm_result.ovirt_vms }}" ignore_errors: true - name: Change state in next_run and reboot ovirt_vm: name: "{{ item.name }}" auth: "{{ ovirt_auth }}" state: next_run wait: true boot_devices: - hd with_items: - "{{ vm_result.ovirt_vms }}" ignore_errors: true What's wrong? Thank you! _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/CYVEOCXTZLREOW...

Hi, in debug mode I haven't any error. The reboot can't be invoked when the VMs are in running state.

Hi Alessio, I just tested it and it seems to be working without a problem. To explain the examples which you sent, might help. The `next_run: true` "prepares" the VM parameters and after reboot, the parameters will be set. I noticed that you did not set any parameter to the VM in that task, so it has nothing to do. And as for the second example, with `state: next_run`, this updates the parameters and reboots automatically. Please check out if the VM does not already have boot_devices set to hard disk. Martin Necas On Fri, May 14, 2021 at 1:36 PM Alessio B. <alessio.battaglia.1981@gmail.com> wrote:
Hi,
in debug mode I haven't any error. The reboot can't be invoked when the VMs are in running state. _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/FBHDUVENYMKPZV...

On Fri, May 14, 2021 at 6:57 PM Martin Necas <mnecas@redhat.com> wrote:
Hi Alessio,
I just tested it and it seems to be working without a problem.
To explain the examples which you sent, might help.
The `next_run: true` "prepares" the VM parameters and after reboot, the parameters will be set. I noticed that you did not set any parameter to the VM in that task, so it has nothing to do.
And as for the second example, with `state: next_run`, this updates the parameters and reboots automatically.
It checks the state of the parameters if it should update them or not, if it is already HD it does not need any update so it just passes.
Please check out if the VM does not already have boot_devices set to hard disk.
Martin Necas
On Fri, May 14, 2021 at 1:36 PM Alessio B. < alessio.battaglia.1981@gmail.com> wrote:
Hi,
in debug mode I haven't any error. The reboot can't be invoked when the VMs are in running state. _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/FBHDUVENYMKPZV...

Hi Martin, Thank you for the help, I have modified my playbook without the first task. Here is it: - name: Change state in next_run and reboot ovirt_vm: name: "{{ item.name }}" auth: "{{ ovirt_auth }}" state: next_run wait: true with_items: - "{{ vm_result.ovirt_vms }}" ignore_errors: true The VMs doesn't reboot. Nothing has changed, I can't understand where is my error. Here my scenario by ansible playbook: 1) turn on VMs (Works fine) 2) first reboot (NO) 3) second reboot (NO)

You are not providing any other parameters that's why it does not reboot. In ansible, you are inputting what state you want to have the machine. Let's say that you have some running VM with 2GiB of RAM and you want to change it to 4GiB. If you will start the playbook for the first time it will change to 4GiB and reboot, but the second time no changes because it already has 4GiB, so no change needed. The same goes for the boot, I guess the VM already had HD boot and you were trying to change it to it, ansible checked that it was not necessary. On Fri, May 14, 2021 at 8:25 PM Alessio B. <alessio.battaglia.1981@gmail.com> wrote:
Hi Martin,
Thank you for the help, I have modified my playbook without the first task. Here is it:
- name: Change state in next_run and reboot ovirt_vm: name: "{{ item.name }}" auth: "{{ ovirt_auth }}" state: next_run wait: true with_items: - "{{ vm_result.ovirt_vms }}" ignore_errors: true
The VMs doesn't reboot. Nothing has changed, I can't understand where is my error.
Here my scenario by ansible playbook:
1) turn on VMs (Works fine) 2) first reboot (NO) 3) second reboot (NO) _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/CMOUQHPWKPP3RS...

Shouldn't it be opened against the ovirt collection? https://github.com/oVirt/ovirt-ansible-collection/issues On 11/5/18 11:23 AM, Ondra Machacek wrote:
Joey is right, we don't such functionality. But feel free to open an issue here[1] and we can implement it.
[1] https://github.com/ansible/ansible/issues
On 11/3/18 1:10 AM, Joey Ma wrote:
hi,
AFAIK, setting state=stopped is the only way to poweroff a VM. While to reboot a VM, you could also follow the steps below: 1. Update a VM with some new properties that requires a restart operation, also with the param: next_run=true 2. Set state=next_run in your playbook and apply it
Then the VM could reboot automatically.
On Sat, Nov 3, 2018 at 1:19 AM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello, is there a way to poweroff or reboot (without stopped and running state) a vm with the ovirt_vm ansible module?
-- Nathanaël Blanchet
Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr _______________________________________________ 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/EBJOTJJKW3TGI6...
_______________________________________________ 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/L5PEO3WOODJIB2...
_______________________________________________ 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/3HPGM2N7WTTV5S...
participants (7)
-
Alessio B.
-
Joey Ma
-
Klaas Demter
-
Martin Necas
-
Nathanaël Blanchet
-
Ondra Machacek
-
Strahil Nikolov