Vmware.Collection: vmware_guest_snapshot setting expiration

28 views
Skip to first unread message

kyle jones

unread,
Mar 12, 2023, 6:00:26 PM3/12/23
to Ansible Project
Hello,

Does anyone have any documentation or know what parameters to use when using vmware_guest_snapshot to take snapshot, but adding an expiration period? 

I looked over the ansible docs a few times and I did not see it.


ironma...@gmail.com

unread,
Mar 12, 2023, 6:38:57 PM3/12/23
to ansible...@googlegroups.com
Hey Kyle – I have done a bit of ansible playbooks for the VI environment I work in…I had found that ansible is someone limit with the VI module.    I have accomplished everything with PowerCLI with ansible.windows.win_shell module.     I run it all from the Ansible server by installing Powershell on the RHEL ansible server.    This setup allows us to run deeper/more complicated plays.    
 
My 2 cents…

--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ed094263-70fd-49c7-b140-7dfc408f3239n%40googlegroups.com.

kyle jones

unread,
Mar 12, 2023, 10:14:20 PM3/12/23
to ansible...@googlegroups.com
Ah! Okay then it’s not just me. Mind pointing out some documentation on the powershell script? 

You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/WeN4U0Rcgic/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/214101d95533%2467e00d10%2437a02730%24%40gmail.com.

Stefan Coussens

unread,
Mar 13, 2023, 9:06:15 AM3/13/23
to ansible...@googlegroups.com
I don't know if you use tower but what I do is take a snapshot named "snapshot by ansible" and  for the removal I use the absent parameter  (state: absent) and schedule the playbook to run at a certain time.



ironma...@gmail.com

unread,
Mar 14, 2023, 10:55:14 AM3/14/23
to ansible...@googlegroups.com

Just a example but there is a lot out there:   https://petri.com/use-powercli-create-snapshot/

 

Examples of the plays that I run:

 

- name: Check the servers in the cluster to ensure none are offline

  ansible.builtin.shell: |

    Connect-VIServer -Server "{{ inventory_hostname }}" -User "{{ Admin_Acct }}" -Password "{{ Admin_Pass }}" | Out-Null

    $NotRespondingHost = (Get-Cluster | Get-VMHost | ? { $_.ConnectionState -match "NotResponding"}).Name

    ForEach ($NotRespondingHost in $NotRespondingHosts) {

       $pos = $NotRespondingHost.IndexOf(".")

       $ESXi_name = $NotRespondingHost.Substring(0, $pos)

       $domain_name = $NotRespondingHost.Substring($pos+1)

       $ESXi_name + "._ilo." + $domain_name

    }

  args:

    executable: /usr/bin/pwsh

  register: NotRespondingHostILO_Pre

  delegate_to: localhost

kyle jones

unread,
Mar 20, 2023, 2:48:32 PM3/20/23
to Ansible Project
We don't have tower but I am planning on building AWX. We only have satellite and it is very limited. 

kyle jones

unread,
Mar 20, 2023, 2:49:12 PM3/20/23
to Ansible Project
Thank you for sharing!
Reply all
Reply to author
Forward
0 new messages