@ -157,11 +157,11 @@ Create an instance
The full range of GCP modules provide the ability to create a wide variety of
The full range of GCP modules provide the ability to create a wide variety of
GCP resources with the full support of the entire GCP API.
GCP resources with the full support of the entire GCP API.
The following playbook creates a GCE Instance. This instance relies on a GCP
The following playbook creates a GCE Instance. This instance relies on other GCP
network and a Disk. By creating the Disk and Network separately, we can give as
resources like Disk. By creating other resources separately, we can give as
much detail as necessary about how we want the disk and network formatted. By
much detail as necessary about how we want to configure the other resources, for example
registering a D isk/Ne twork to a variable, we can simply insert the variable
formatting of the Disk. By registering it to a variable, we can simply insert the
into the instance task. The gcp_compute_instance module will figure out the
variable into the instance task. The gcp_compute_instance module will figure out the
rest.
rest.
.. code-block :: yaml
.. code-block :: yaml
@ -190,16 +190,6 @@ rest.
- https://www.googleapis.com/auth/compute
- https://www.googleapis.com/auth/compute
state: present
state: present
register: disk
register: disk
- name: create a network
gcp_compute_network:
name: 'network-instance'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/compute
state: present
register: network
- name: create a address
- name: create a address
gcp_compute_address:
gcp_compute_address:
name: 'address-instance'
name: 'address-instance'
@ -221,7 +211,7 @@ rest.
boot: true
boot: true
source: "{{ disk }}"
source: "{{ disk }}"
network_interfaces:
network_interfaces:
- network: "{{ network }}"
- network: null # use default
access_configs:
access_configs:
- name: 'External NAT'
- name: 'External NAT'
nat_ip: "{{ address }}"
nat_ip: "{{ address }}"