Skip to content

Commit

Permalink
Merge 4c16d7c into 61396c7
Browse files Browse the repository at this point in the history
  • Loading branch information
rambleraptor authored May 3, 2018
2 parents 61396c7 + 4c16d7c commit 083793b
Show file tree
Hide file tree
Showing 32 changed files with 904 additions and 234 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
url = git@github.com:GoogleCloudPlatform/chef-google-logging
[submodule "build/ansible"]
path = build/ansible
url = git@github.com:ansible/ansible.git
url = git@github.com:modular-magician/ansible
branch = devel
[submodule "build/terraform"]
path = build/terraform
url = git@github.com:terraform-providers/terraform-provider-google.git
Expand Down
69 changes: 33 additions & 36 deletions products/compute/ansible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,43 @@ manifest: !ruby/object:Provider::Ansible::Manifest
author: Google Inc. (@googlecloudplatform)
# This is where custom code would be defined eventually.
overrides: !ruby/object:Provider::ResourceOverrides
Firewall: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
BackendService: !ruby/object:Provider::Ansible::ResourceOverride
aliases:
timeoutSec:
- timeout_seconds
Disk: !ruby/object:Provider::Ansible::ResourceOverride
editable: false
HealthCheck: !ruby/object:Provider::Ansible::ResourceOverride
aliases:
timeoutSec:
- timeout_seconds
HttpHealthCheck: !ruby/object:Provider::Ansible::ResourceOverride
aliases:
timeoutSec:
- timeout_seconds
checkIntervalSec:
- check_interval_seconds
HttpsHealthCheck: !ruby/object:Provider::Ansible::ResourceOverride
aliases:
timeoutSec:
- timeout_seconds
Instance: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
InstanceGroupManager: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
provider_helpers:
- 'products/compute/helpers/provider_instance.py'
- 'products/compute/helpers/instance_metadata.py'
InstanceGroup: !ruby/object:Provider::Ansible::ResourceOverride
editable: false
InstanceTemplate: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
provider_helpers:
- 'products/compute/helpers/provider_instance.py'
- 'products/compute/helpers/instance_metadata.py'
TargetPool: !ruby/object:Provider::Ansible::ResourceOverride
provider_helpers:
- 'products/compute/helpers/provider_target_pool.py'
# Not yet implemented.
Snapshot: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
TargetHttpsProxy: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
TargetSslProxy: !ruby/object:Provider::Ansible::ResourceOverride
TargetVpnGateway: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
# Ansible tasks must alter infrastructure.
# This means that virtual objects are a poor fit.
Expand All @@ -51,33 +75,6 @@ overrides: !ruby/object:Provider::ResourceOverrides
exclude: true
Zone: !ruby/object:Provider::Ansible::ResourceOverride
exclude: true
# TODO(https://github.com/GoogleCloudPlatform/magic-modules/issues/47): Migrate objects to overrides
objects: !ruby/object:Api::Resource::HashArray
Disk:
editable: false
InstanceGroup:
editable: false
HealthCheck:
aliases:
timeoutSec:
- timeout_seconds
HttpHealthCheck:
aliases:
timeoutSec:
- timeout_seconds
HttpsHealthCheck:
aliases:
timeoutSec:
- timeout_seconds
TargetPool:
provider_helpers:
include:
- 'products/compute/helpers/provider_target_pool.py'
# Not implemented yet.
BackendService:
aliases:
timeoutSec:
- timeout_seconds
examples: !ruby/object:Api::Resource::HashArray
files: !ruby/object:Provider::Config::Files
copy:
Expand Down
37 changes: 37 additions & 0 deletions products/compute/examples/ansible/firewall.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
--- !ruby/object:Provider::Ansible::Example
task: !ruby/object:Provider::Ansible::Task
name: gcp_compute_firewall
code: |
name: <%= ctx[:name] %>
allowed:
- ip_protocol: 'tcp'
ports:
- "22"
target_tags:
- test-ssh-server
- staging-ssh-server
source_tags:
- test-ssh-clients
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
verifier: !ruby/object:Provider::Ansible::Verifier
command: |
gcloud compute firewall-rules describe
--project="{{ gcp_project}}"
"{{ resource_name }}"
failure: !ruby/object:Provider::Ansible::ComputeFailureCondition
region: global
type: firewalls
73 changes: 73 additions & 0 deletions products/compute/examples/ansible/instance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
--- !ruby/object:Provider::Ansible::Example
dependencies:
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_disk
register: disk
code: |
name: <%= dependency_name('disk', 'instance') %>
size_gb: 50
source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
zone: us-central1-a
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_network
register: network
code: |
name: <%= dependency_name('network', 'instance') %>
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_address
register: address
code: |
name: <%= dependency_name('address', 'instance') %>
region: 'us-central1'
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
task: !ruby/object:Provider::Ansible::Task
name: gcp_compute_instance
code: |
name: <%= ctx[:name] %>
machine_type: n1-standard-1
disks:
- auto_delete: true
boot: true
source: "{{ disk }}"
metadata:
startup-script-url: 'gs:://graphite-playground/bootstrap.sh'
cost-center: '12345'
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: 'External NAT'
nat_ip: "{{ address }}"
type: 'ONE_TO_ONE_NAT'
zone: 'us-central1-a'
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
verifier: !ruby/object:Provider::Ansible::Verifier
command: |
gcloud compute instances describe
--project="{{ gcp_project }}"
--zone="us-central1-a"
"{{ resource_name }}"
failure: !ruby/object:Provider::Ansible::ComputeFailureCondition
region: zones/us-central1-a
type: instances
1 change: 0 additions & 1 deletion products/compute/examples/ansible/instance_group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
task: !ruby/object:Provider::Ansible::Task
name: gcp_compute_instance_group
code: |
Expand Down
72 changes: 72 additions & 0 deletions products/compute/examples/ansible/instance_group_manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
--- !ruby/object:Provider::Ansible::Example
dependencies:
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_network
register: network
code: |
name: <%= dependency_name('network', 'instanceTemplate') %>
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_address
register: address
code: |
name: <%= dependency_name('address', 'instanceTemplate') %>
region: 'us-west1'
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_instance_template
register: instancetemplate
code: |
name: <%= ctx[:name] %>
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: 'test-config'
type: 'ONE_TO_ONE_NAT'
nat_ip: "{{ address }}"
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
task: !ruby/object:Provider::Ansible::Task
name: gcp_compute_instance_group_manager
code: |
name: <%= ctx[:name] %>
base_instance_name: 'test1-child'
instance_template: "{{ instancetemplate }}"
target_size: 3
zone: 'us-west1-a'
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
verifier: !ruby/object:Provider::Ansible::Verifier
command: |
gcloud compute instance-groups managed describe
--zone=us-west1-a
--project="{{ gcp_project}}"
"{{ resource_name }}"
failure: !ruby/object:Provider::Ansible::ComputeFailureCondition
region: zones/us-west1-a
type: instanceGroupManagers
59 changes: 59 additions & 0 deletions products/compute/examples/ansible/instance_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
--- !ruby/object:Provider::Ansible::Example
dependencies:
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_network
register: network
code: |
name: <%= dependency_name('network', 'instanceTemplate') %>
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
- !ruby/object:Provider::Ansible::Task
name: gcp_compute_address
register: address
code: |
name: <%= dependency_name('address', 'instanceTemplate') %>
region: 'us-west1'
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
task: !ruby/object:Provider::Ansible::Task
name: gcp_compute_instance_template
code: |
name: <%= ctx[:name] %>
properties:
disks:
- auto_delete: true
boot: true
initialize_params:
source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
machine_type: n1-standard-1
network_interfaces:
- network: "{{ network }}"
access_configs:
- name: 'test-config'
type: 'ONE_TO_ONE_NAT'
nat_ip: "{{ address }}"
project: <%= ctx[:project] %>
auth_kind: <%= ctx[:auth_kind] %>
service_account_file: <%= ctx[:service_account_file] %>
verifier: !ruby/object:Provider::Ansible::Verifier
command: |
gcloud compute instance-templates describe
--project="{{ gcp_project}}"
"{{ resource_name }}"
failure: !ruby/object:Provider::Ansible::ComputeFailureCondition
region: global
type: instanceTemplates
Loading

0 comments on commit 083793b

Please sign in to comment.