From 303fa6b478f34d77c252c583e0124bf294c784fd Mon Sep 17 00:00:00 2001 From: Jasmine Hegman Date: Sat, 27 Oct 2018 23:17:44 -0700 Subject: [PATCH] Add to k8s_raw docs re: vault-encrypted files (#47328) * Add to k8s_raw docs re: vault-encrypted files I didn't read the examples far enough and maybe would not have tried all the examples so I ended up creating https://github.com/ansible/ansible/issues/47259 and learned that definition key with lookup works well and we agreed the docs should say something. :) +label: docsite_pr * Add note about ansible vault-encrypted files to src: param * Remove trailing whitespace * Make changes from feedback * Make feedback changes --- lib/ansible/modules/clustering/k8s/k8s.py | 6 ++++-- .../utils/module_docs_fragments/k8s_resource_options.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/clustering/k8s/k8s.py b/lib/ansible/modules/clustering/k8s/k8s.py index 999d8ba0a1..6c4616a27f 100644 --- a/lib/ansible/modules/clustering/k8s/k8s.py +++ b/lib/ansible/modules/clustering/k8s/k8s.py @@ -28,7 +28,7 @@ author: description: - Use the OpenShift Python client to perform CRUD operations on K8s objects. - Pass the object definition from a source file or inline. See examples for reading - files and using Jinja templates. + files and using Jinja templates or vault-encrypted files. - Access to the full range of K8s APIs. - Use the M(k8s_facts) module to obtain a list of items about an object of type C(kind) - Authenticate using either a config file, certificates, password or token. @@ -116,7 +116,9 @@ EXAMPLES = ''' state: present src: /testing/deployment.yml -- name: Read definition file from the Ansible controller file system +- name: >- + Read definition file from the Ansible controller file system. + If the definition file has been encrypted with Ansible Vault it will automatically be decrypted. k8s: state: present definition: "{{ lookup('file', '/testing/deployment.yml') }}" diff --git a/lib/ansible/utils/module_docs_fragments/k8s_resource_options.py b/lib/ansible/utils/module_docs_fragments/k8s_resource_options.py index 833e6dd18f..25adb32db5 100644 --- a/lib/ansible/utils/module_docs_fragments/k8s_resource_options.py +++ b/lib/ansible/utils/module_docs_fragments/k8s_resource_options.py @@ -35,7 +35,7 @@ options: - "Provide a path to a file containing a valid YAML definition of an object or objects to be created or updated. Mutually exclusive with I(resource_definition). NOTE: I(kind), I(api_version), I(name), and I(namespace) will be overwritten by corresponding values found in the configuration read in from the I(src) file." - - Reads from the local file system. To read from the Ansible controller's file system, use the file lookup + - Reads from the local file system. To read from the Ansible controller's file system, including vaulted files, use the file lookup plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to I(resource_definition). See Examples below. '''