June 2020
Intermediate to advanced
410 pages
9h 52m
English
Now that Ansible is able to connect to your GCP environment, you can proceed with the actual Playbook:
---- hosts: localhost tasks: - name: create a instance gcp_compute_instance: name: TestMachine machine_type: n1-standard-1 disks: - auto_delete: 'true' boot: 'true' initialize_params: source_image: family/centos-7 disk_size_gb: 10 zone: eu-west1-c auth_kind: serviceaccount service_account_file: "~/sa.json" state: present
Execute it with the following command:
$ ansible-playbook gce.yaml
This will create an output like the following one:
PLAY [localhost] **********************************************************************************TASK [Gathering Facts] ...