application-research / ehi-proxmaas

Integrates Proxmox, MAAS and Technitium to provide one-touch deployment of many machines
MIT License
1 stars 1 forks source link

destroy.yml isn't destroying well enough! #2

Closed PC-Admin closed 1 year ago

PC-Admin commented 1 year ago

a reminder at the end of destroy to delete in MASS too might be handy!

Zorlin commented 1 year ago

Was working fine for me. Please offer exact steps for reproducing this as I think you're "holding it wrong" :)

On Fri, Apr 21, 2023, 6:36 AM Michael @.***> wrote:

Fails with:

TASK [Set the starting number for the VMs] ** fatal: [localhost]: FAILED! => {"msg": "The conditional check 'vm_count is not defined or vm_count.length == 0' failed. The error was: error while evaluating conditional (vm_count is not defined or vm_count.length == 0): 'str object' has no attribute 'length'. 'str object' has no attribute 'length'\n\nThe error appears to be in '/home/pcadmin/MyVault/Estuary_LIVE/LATEST/estuary-hosted-infrastructure/playbooks/ehi-proxmaas/destroy.yml': line 65, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Set the starting number for the VMs\n ^ here\n"}

could also use a section to import the related vars if needed:

  • name: Delete Proxmox Virtual Machines hosts: proxmox_clients connection: local

    vars_files:

    • "vars/production-ehi/{{ machine_details | default('dev-demo') }}.yml"

the whole thing could use a tune-up, but it's not a high priority for now

— Reply to this email directly, view it on GitHub https://github.com/application-research/ehi-proxmaas/issues/2#issuecomment-1517025287, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKONLBZFIKVA37KN3IG333XCG3AFANCNFSM6AAAAAAW4OYNY4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

PC-Admin commented 1 year ago

Indeed I was, seems to work fine when I tried it today. :sweat_smile:

PC-Admin commented 1 year ago

This is perhaps something worth fixing:

TASK [Destroy the requested VMs] ****************************************************************************************************************
ok: [localhost] => (item=1) => {"ansible_loop_var": "item", "changed": false, "item": 1, "msg": "VM 133 is running. Stop it before deletion or use force=true.", "vmid": 133}
ok: [localhost] => (item=2) => {"ansible_loop_var": "item", "changed": false, "item": 2, "msg": "VM 134 is running. Stop it before deletion or use force=true.", "vmid": 134}
ok: [localhost] => (item=3) => {"ansible_loop_var": "item", "changed": false, "item": 3, "msg": "VM 135 is running. Stop it before deletion or use force=true.", "vmid": 135}

although I suspect we're better off just SSH'ing in and shutting the VMs down beforehand with a bash loop or something...

Zorlin commented 1 year ago

Yeah, that's a feature, not a bug. This should NEVER destroy running VMs.

On Thu, May 4, 2023, 9:06 AM Michael @.***> wrote:

This is perhaps something worth fixing:

TASK [Destroy the requested VMs] **** ok: [localhost] => (item=1) => {"ansible_loop_var": "item", "changed": false, "item": 1, "msg": "VM 133 is running. Stop it before deletion or use force=true.", "vmid": 133} ok: [localhost] => (item=2) => {"ansible_loop_var": "item", "changed": false, "item": 2, "msg": "VM 134 is running. Stop it before deletion or use force=true.", "vmid": 134} ok: [localhost] => (item=3) => {"ansible_loop_var": "item", "changed": false, "item": 3, "msg": "VM 135 is running. Stop it before deletion or use force=true.", "vmid": 135}

although I suspect we're better off just SSH'ing in and shutting the VMs down beforehand with a bash loop or something...

— Reply to this email directly, view it on GitHub https://github.com/application-research/ehi-proxmaas/issues/2#issuecomment-1534263245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKONLDMYQNZEMU42GR75BLXENPRRANCNFSM6AAAAAAW4OYNY4 . You are receiving this because you commented.Message ID: @.***>

Zorlin commented 1 year ago

In fact, automating it to do so whether with an SSH loop or force is an antifeature.

We need it to be manual because otherwise you can easily destroy the wrong machine or a machine you weren't intending to. Do not fix.

On Thu, May 4, 2023, 9:08 AM Benjamin @.***> wrote:

Yeah, that's a feature, not a bug. This should NEVER destroy running VMs.

On Thu, May 4, 2023, 9:06 AM Michael @.***> wrote:

This is perhaps something worth fixing:

TASK [Destroy the requested VMs] **** ok: [localhost] => (item=1) => {"ansible_loop_var": "item", "changed": false, "item": 1, "msg": "VM 133 is running. Stop it before deletion or use force=true.", "vmid": 133} ok: [localhost] => (item=2) => {"ansible_loop_var": "item", "changed": false, "item": 2, "msg": "VM 134 is running. Stop it before deletion or use force=true.", "vmid": 134} ok: [localhost] => (item=3) => {"ansible_loop_var": "item", "changed": false, "item": 3, "msg": "VM 135 is running. Stop it before deletion or use force=true.", "vmid": 135}

although I suspect we're better off just SSH'ing in and shutting the VMs down beforehand with a bash loop or something...

— Reply to this email directly, view it on GitHub https://github.com/application-research/ehi-proxmaas/issues/2#issuecomment-1534263245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKONLDMYQNZEMU42GR75BLXENPRRANCNFSM6AAAAAAW4OYNY4 . You are receiving this because you commented.Message ID: @.***>