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?
Hello,
I’m also new to ansible and I had the same problem with you. I got hint from [this answer](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). 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!