# how to create a GCP disk from a GCP snapshot

**URL:** <https://forum.ansible.com/t/how-to-create-a-gcp-disk-from-a-gcp-snapshot/35137>\
**Category:** Ansible Project\
**Tags:** gcp\
**Created:** [May 9, 2021, 2:02pm UTC](https://forum.ansible.com/t/how-to-create-a-gcp-disk-from-a-gcp-snapshot/35137 "2021-05-09T14:02:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thor01](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@thor01](https://forum.ansible.com/u/thor01)\
**Post date:** [May 9, 2021, 2:02pm UTC](https://forum.ansible.com/t/how-to-create-a-gcp-disk-from-a-gcp-snapshot/35137/1 "2021-05-09T14:02:05Z")

</div>

Hi all, I am new to Ansible and I am trying to figure out who to create a GCP disk from a GCP snapshot, using the gcp\_compute\_disk module. I am using the following documentation: [https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp\_compute\_snapshot\_module.html](https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_compute_snapshot_module.html)  
I created the playbook below, but it only creates an empty new disk, not a disk from the snapshot. My ansible version is 2.9.20. Thank you.

- name: Create GCP snapshots  
hosts: localhost  
gather\_facts: yes  
vars:  
gcp\_project: test-project  
gcp\_cred\_kind: serviceaccount  
gcp\_cred\_file: /etc/ansible/keys/ansible-test-project-service-account-key.json  
zone: “us-central1-a”  
region: “us-central1”  
instancename: “test-instance”  
snapshot:  
selfLink: [https://www.googleapis.com/compute/v1/projects/test-project/global/snapshots/test-snapshot1](https://www.googleapis.com/compute/v1/projects/test-project/global/snapshots/test-snapshot1)

tasks:

- name: create data disk from a snapshot  
gcp\_compute\_disk:  
name: “{{ instancename }}-data-1”  
description: “{{ instancename }}-data-1”  
zone: “{{ zone }}”  
project: “{{ gcp\_project }}”  
auth\_kind: “{{ gcp\_cred\_kind }}”  
service\_account\_file: “{{ gcp\_cred\_file }}”  
source\_snapshot: “{{ snapshot }}”  
labels:  
usage: test-label  
type: “[https://www.googleapis.com/compute/v1/projects/test-project/zones/us-central1-b/diskTypes/pd-standard](https://www.googleapis.com/compute/v1/projects/test-project/zones/us-central1-b/diskTypes/pd-standard)”  
state: present  
register: disk\_data
