Adding to my earlier message .. we use these playbooks in a patching workflow. Snapshot, Patch, if patching fails, revert snapshot.
Walter -- Walter Rowe, Division Chief Infrastructure Services Division Mobile: 202.355.4123 On Jan 22, 2024, at 7:22 AM, 'Rowe, Walter P. (Fed)' via Ansible Project <ansible-project@googlegroups.com> wrote: We have these playbooks we use to create a snapshot and to revert a snapshot. The go into an ansible automation platform workflow. The esx-vars.yml has a dictionary you will need to modify for your environment. The dictionary key is a vcenter ID you create. We pass in an extravar for datacenter that provides the value of that key to look up at run time. We have an east and west vCenter and a sandbox we call "vCloud". You will see vc_east, vc_west, vc_vcloud keys in the esx_vars.yml dictionary. The esx-create-snapshot.yml gets info about the existing machine, powers it down, creates the snapshot, then powers it back up ONLY if it was powered on when we started (state: "{{ snapvm.instance.hw_power_status | lower }}" at line 74 comes from the guest info we get at line 31). At the bottom of esx-snapshot-create.yml we use set_stats to artifacts so they can be used downstream in the AAP workflow by ex-snapshot-revert.yml including its powered on status. Even if you don't use these playbooks they may help you craft your own. Walter -- Walter Rowe, Division Chief Infrastructure Services Division Mobile: 202.355.4123 On Jan 22, 2024, at 3:36 AM, Prady A <pradyumna....@gmail.com> wrote: Hi Rilindo, Thanks for your reply. That was typo error . I fixed the issue, in the REST api i need to pass memory flag which by default is false. This memory flag retains the machine power status also. Thank you for your all support. PD On Mon, 22 Jan 2024 at 13:50, Rilindo Foster <rili...@gmail.com<mailto:rili...@gmail.com>> wrote: Is that a space before snapshot (right where it says “Task” in the JSON request)? Was that part of the request or did you insert that by mistake when you copied it into the email? - Rilindo On Jan 21, 2024, at 9:13 PM, Prady A <pradyumna....@gmail.com<mailto:pradyumna....@gmail.com>> wrote: Hi, Thank you both of you for your kind suggestions. We are using leap-upgrade tool to upgrade. In upgrade there is no issue. We have a health checkup also post upgrade. The issue is in VMware but not sure when creating manually the “Snapshot the virtual machine memory” is set to Yes but when I am creating the snapshot through ansible automatically it is setting as No. This is something with VMware maybe.. - Name: Create VM snapshot Uri: URL: https://api.xyz/virtualization/snapshot/snow User: “ {{ snapshot_user }}” Password: “{{ snapshot_Password }}“ force_basic_auth: true Method: post Body_format: json Body: |- { “Hostname”: “{{ vm_hostname }}”, “Task”: “ create”, “Snapshot_name”: “upgrade-{{vm_hostname}} “ } Status code: 202 Register: snapshot_result Regards PD On Sun, 21 Jan 2024 at 07:15, Nico Kadel-Garcia <nka...@gmail.com<mailto:nka...@gmail.com>> wrote: On Thu, Jan 18, 2024 at 8:16 PM Prady A <pradyumna....@gmail.com<mailto:pradyumna....@gmail.com>> wrote: > > Hi experts, > > We are doing automation to update RHEL7-> RHEL8 . > Before we upgrade we take the snapshot. > The issue is whenever there is an upgrade failure we revert the server to its > previous state. But it seems when we revert it the machine is in power off > state.. > it seems when we take automatic snapshot it happens like that.. Any pointers > pls > > Regards > PD That's a RHEL problem. It's not an operation supported by RHEL. Updating the critical system libraries, such as glibc and the python on which RPM is based, and RPM itself, is likely to trip over a *lot* of problems without quite a lot of research and debugging. From decades of experience with Red Hat based operating systems, I recommend very strongly against this approach. If I may suggest, take a disk image of the old system and build a new system, with content copied as needed to configure the new system. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project%2bunsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOCN9ry6d0wKwzJutwXDJSMH3X9vD51hLVqqtbJd9rHzRfkEKQ%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEuB3AoFvdepBuNSvKHQ%3Dc_TYpwUUjrF8QYdgMd_MKb22-8v8A%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAEuB3AoFvdepBuNSvKHQ%3Dc_TYpwUUjrF8QYdgMd_MKb22-8v8A%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5C29FCDA-9E8E-43D0-B343-46D172B5EF4F%40gmail.com<https://groups.google.com/d/msgid/ansible-project/5C29FCDA-9E8E-43D0-B343-46D172B5EF4F%40gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq-wtE%2Bd73_Cj%2B-3HeBYpFO-qs5m_Q8TDA_r9FL4bO-Rw%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAEuB3Aq-wtE%2Bd73_Cj%2B-3HeBYpFO-qs5m_Q8TDA_r9FL4bO-Rw%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6B483116-AE3A-4F0A-933F-5BCF6A6C3A7C%40nist.gov<https://groups.google.com/d/msgid/ansible-project/6B483116-AE3A-4F0A-933F-5BCF6A6C3A7C%40nist.gov?utm_medium=email&utm_source=footer>. <esx-snapshot-create.yml><esx-snapshot-revert.yml><esx-vars.yml> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/F3F3793A-97EB-48F7-A355-6F0AB6D8AD35%40nist.gov.