diff --git a/build/ansible b/build/ansible index 6415be57e318..a1e2554c85b9 160000 --- a/build/ansible +++ b/build/ansible @@ -1 +1 @@ -Subproject commit 6415be57e3186b2d381dca5f4b4f4e8b006ef5fc +Subproject commit a1e2554c85b9b778938f0bceb0d8cfb143cdf2aa diff --git a/products/compute/ansible.yaml b/products/compute/ansible.yaml index 552a3756d239..f40c50220926 100644 --- a/products/compute/ansible.yaml +++ b/products/compute/ansible.yaml @@ -14,14 +14,14 @@ --- !ruby/object:Provider::Ansible::Config # This is where custom code would be defined eventually. datasources: !ruby/object:Overrides::ResourceOverrides - Autoscaler: !ruby/object:Overrides::Ansible::ResourceOverride - exclude: true BackendBucketSignedUrlKey: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true BackendServiceSignedUrlKey: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true ManagedSslCertificate: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true + RegionAutoscaler: !ruby/object:Overrides::Ansible::ResourceOverride + exclude: true # Readonly resources. DiskType: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true @@ -37,8 +37,6 @@ datasources: !ruby/object:Overrides::ResourceOverrides exclude: true NodeTemplate: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true - RegionAutoscaler: !ruby/object:Overrides::Ansible::ResourceOverride - exclude: true RegionBackendService: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true Region: !ruby/object:Overrides::Ansible::ResourceOverride @@ -52,6 +50,26 @@ datasources: !ruby/object:Overrides::ResourceOverrides Zone: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true overrides: !ruby/object:Overrides::ResourceOverrides + Autoscaler: !ruby/object:Overrides::Ansible::ResourceOverride + properties: + autoscalingPolicy.minNumReplicas: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['minReplicas'] + autoscalingPolicy.maxNumReplicas: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['maxReplicas'] + autoscalingPolicy.coolDownPeriodSec: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['cooldownPeriod'] + autoscalingPolicy.cpuUtilization.utilizationTarget: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['target'] + autoscalingPolicy.customMetricUtilizations: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['metric'] + autoscalingPolicy.customMetricUtilizations.metric: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['name'] + autoscalingPolicy.customMetricUtilizations.utilizationTarget: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['target'] + autoscalingPolicy.customMetricUtilizations.utilizationTargetType: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['type'] + autoscalingPolicy.loadBalancingUtilization.utilizationTarget: !ruby/object:Overrides::Ansible::PropertyOverride + aliases: ['target'] BackendService: !ruby/object:Overrides::Ansible::ResourceOverride properties: timeoutSec: !ruby/object:Overrides::Ansible::PropertyOverride @@ -234,8 +252,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides TargetVpnGateway: !ruby/object:Overrides::Ansible::ResourceOverride exclude: false # Not yet implemented. - Autoscaler: !ruby/object:Overrides::Ansible::ResourceOverride - exclude: true BackendBucketSignedUrlKey: !ruby/object:Overrides::Ansible::ResourceOverride exclude: true BackendServiceSignedUrlKey: !ruby/object:Overrides::Ansible::ResourceOverride diff --git a/products/compute/ansible_version_added.yaml b/products/compute/ansible_version_added.yaml index 041af8c90ffb..33d602a88a8f 100644 --- a/products/compute/ansible_version_added.yaml +++ b/products/compute/ansible_version_added.yaml @@ -2,6 +2,8 @@ :facts: :Address: :version_added: '2.7' + :Autoscaler: + :version_added: '2.9' :BackendBucket: :version_added: '2.7' :BackendService: @@ -83,6 +85,44 @@ :version_added: '2.7' :region: :version_added: '2.6' + :Autoscaler: + :version_added: '2.9' + :name: + :version_added: '2.9' + :description: + :version_added: '2.9' + :autoscalingPolicy: + :version_added: '2.9' + :minNumReplicas: + :version_added: '2.9' + :maxNumReplicas: + :version_added: '2.9' + :coolDownPeriodSec: + :version_added: '2.9' + :cpuUtilization: + :version_added: '2.9' + :utilizationTarget: + :version_added: '2.9' + :customMetricUtilizations: + :version_added: '2.9' + :metric: + :version_added: '2.9' + :singleInstanceAssignment: + :version_added: '2.9' + :utilizationTarget: + :version_added: '2.9' + :utilizationTargetType: + :version_added: '2.9' + :filter: + :version_added: '2.9' + :loadBalancingUtilization: + :version_added: '2.9' + :utilizationTarget: + :version_added: '2.9' + :target: + :version_added: '2.9' + :zone: + :version_added: '2.9' :BackendBucket: :version_added: '2.6' :bucketName: diff --git a/products/compute/examples/ansible/autoscaler.yaml b/products/compute/examples/ansible/autoscaler.yaml new file mode 100644 index 000000000000..5825edfb3696 --- /dev/null +++ b/products/compute/examples/ansible/autoscaler.yaml @@ -0,0 +1,79 @@ +# 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_autoscaler + code: + name: <%= ctx[:name] %> + zone: 'us-central1-a' + target: "{{ igm }}" + autoscaling_policy: + max_num_replicas: 5 + min_num_replicas: 1 + cool_down_period_sec: 60 + cpu_utilization: + utilization_target: 0.5 + project: <%= ctx[:project] %> + auth_kind: <%= ctx[:auth_kind] %> + service_account_file: <%= ctx[:service_account_file] %> +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-central1' + 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] %> + - !ruby/object:Provider::Ansible::Task + name: gcp_compute_instance_group_manager + register: igm + code: + name: <%= ctx[:name] %> + base_instance_name: 'test1-child' + instance_template: "{{ instancetemplate }}" + target_size: 3 + zone: 'us-central1-a' + project: <%= ctx[:project] %> + auth_kind: <%= ctx[:auth_kind] %> + service_account_file: <%= ctx[:service_account_file] %>