# Creating snapshot of an Openstack server/instance using Ansible

**URL:** <https://forum.ansible.com/t/creating-snapshot-of-an-openstack-server-instance-using-ansible/30424>\
**Category:** Ansible Project\
**Created:** [May 26, 2019, 4:02pm UTC](https://forum.ansible.com/t/creating-snapshot-of-an-openstack-server-instance-using-ansible/30424 "2019-05-26T16:02:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdul\_Wahab](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@Abdul\_Wahab](https://forum.ansible.com/u/Abdul_Wahab)\
**Post date:** [May 26, 2019, 4:02pm UTC](https://forum.ansible.com/t/creating-snapshot-of-an-openstack-server-instance-using-ansible/30424/1 "2019-05-26T16:02:50Z")

</div>

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

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?

---

<div class="post-metadata">

**Author:** ![Joey\_Cheng](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Joey\_Cheng](https://forum.ansible.com/u/Joey_Cheng)\
**Post date:** [July 2, 2021, 8:29pm UTC](https://forum.ansible.com/t/creating-snapshot-of-an-openstack-server-instance-using-ansible/30424/2 "2021-07-02T20:29:42Z")

</div>

Hello,

I’m also new to ansible and I had the same problem with you. I got hint from [this answer]([http://I](http://I)’m also new to ansible. I got the same problem with you. I resolved it getting hint from this answer [https://www.reddit.com/r/openstack/comments/btbehk/creating\_snapshot\_of\_an\_openstack\_serverinstance/f3b1gcr?utm\_source=share&utm\_medium=web2x&context=3](https://www.reddit.com/r/openstack/comments/btbehk/creating_snapshot_of_an_openstack_serverinstance/f3b1gcr?utm_source=share&utm_medium=web2x&context=3)). 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!
