Creating snapshot of an Openstack server/instance using Ansible

322 views
Skip to first unread message

Abdul Wahab

unread,
May 26, 2019, 12:02:51 PM5/26/19
to Ansible Project
Hello Everyone,
I have been trying to find an ansible-module that can create a snapshot of a running server/instance on Openstack cloud. I have looked into os_image, os_server_action and os_server modules but couldn't find the option. From the command line you can easily get this snapshot using the command 
openstack server create --name <snapshot-name> <instance-name>
I am running this playbook on the controller node of openstack.

Any suggestion on how can I obtain the equivalent results of the above command using Ansible?

Joey Cheng

unread,
Jul 2, 2021, 4:29:42 PM7/2/21
to Ansible Project

Hello,

I'm also new to ansible and I had the same problem with you. I got hint from this answer. My solution is just using the command as you stated in question, additionally with auth information:

- name: create snapshot for instance
  become: false
  delegate_to: 127.0.0.1
  ansible.builtin.command: openstack server image create --name {{snapshot_name}} {{headNode_name}} --os-auth-url="{{my_auth_url}}" --os-application-credential-id="{{my_application_credential_id}}" --os-application-credential-secret="{{my_application_credential_secret}}" --os-auth-type="{{my_auth_type}}"

The prerequisite is to have openstackcli installed locally.
Hope that helps!


Reply all
Reply to author
Forward
0 new messages