diff --git a/build/ansible b/build/ansible index 941348992017..0ee1fe8fbbd5 160000 --- a/build/ansible +++ b/build/ansible @@ -1 +1 @@ -Subproject commit 94134899201737f2ad596aed290ae02c630d7496 +Subproject commit 0ee1fe8fbbd52d3e83c7951b71513b357d08eb65 diff --git a/products/runtimeconfig/ansible.yaml b/products/runtimeconfig/ansible.yaml index 3f7be9489c73..41999518ad3f 100644 --- a/products/runtimeconfig/ansible.yaml +++ b/products/runtimeconfig/ansible.yaml @@ -17,10 +17,14 @@ datasources: !ruby/object:Overrides::ResourceOverrides facts: !ruby/object:Provider::Ansible::FactsOverride has_filters: false Variable: !ruby/object:Overrides::Ansible::ResourceOverride - exclude: true + facts: !ruby/object:Provider::Ansible::FactsOverride + has_filters: false overrides: !ruby/object:Overrides::ResourceOverrides Variable: !ruby/object:Overrides::Ansible::ResourceOverride - exclude: true + provider_helpers: + - 'products/runtimeconfig/helpers/ansible/variable_delete_config.py' + transport: !ruby/object:Overrides::Ansible::Transport + encoder: encode_request files: !ruby/object:Provider::Config::Files resource: <%= lines(indent(compile('provider/ansible/resource~compile.yaml'), 4)) -%> diff --git a/products/runtimeconfig/ansible_version_added.yaml b/products/runtimeconfig/ansible_version_added.yaml index 6232f3fb58a6..9bd8de31b8d8 100644 --- a/products/runtimeconfig/ansible_version_added.yaml +++ b/products/runtimeconfig/ansible_version_added.yaml @@ -2,6 +2,8 @@ :facts: :Config: :version_added: '2.10' + :Variable: + :version_added: '2.10' :regular: :Config: :version_added: '2.10' @@ -9,3 +11,13 @@ :version_added: '2.10' :name: :version_added: '2.10' + :Variable: + :version_added: '2.10' + :value: + :version_added: '2.10' + :text: + :version_added: '2.10' + :name: + :version_added: '2.10' + :config: + :version_added: '2.10' diff --git a/products/runtimeconfig/api.yaml b/products/runtimeconfig/api.yaml index 44c0e50c3944..0f8d2ffd8965 100644 --- a/products/runtimeconfig/api.yaml +++ b/products/runtimeconfig/api.yaml @@ -62,6 +62,7 @@ objects: The name of the variable resource. required: true input: true + pattern: projects/{{project}}/configs/{{config}}/variables/{{name}} - !ruby/object:Api::Type::String name: 'config' description: | diff --git a/products/runtimeconfig/examples/ansible/variable.yaml b/products/runtimeconfig/examples/ansible/variable.yaml new file mode 100644 index 000000000000..3f496bed8e16 --- /dev/null +++ b/products/runtimeconfig/examples/ansible/variable.yaml @@ -0,0 +1,32 @@ +# 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_runtimeconfig_variable + code: + name: prod-variables/hostname + config: 'my-config' + text: example.com + project: <%= ctx[:project] %> + auth_kind: <%= ctx[:auth_kind] %> + service_account_file: <%= ctx[:service_account_file] %> +dependencies: + - !ruby/object:Provider::Ansible::Task + name: gcp_runtimeconfig_config + code: + name: 'my-config' + description: 'My config' + project: <%= ctx[:project] %> + auth_kind: <%= ctx[:auth_kind] %> + service_account_file: <%= ctx[:service_account_file] %> + register: config diff --git a/products/runtimeconfig/helpers/ansible/variable_delete_config.py b/products/runtimeconfig/helpers/ansible/variable_delete_config.py new file mode 100644 index 000000000000..3013c2e63498 --- /dev/null +++ b/products/runtimeconfig/helpers/ansible/variable_delete_config.py @@ -0,0 +1,19 @@ +# 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. + +# `config` is a useful parameter for declarative syntax, but +# is not a part of the GCP API +def encode_request(request, module): + if 'config' in request: + del request['config'] + return request