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
This commit is contained in:
Jasmine Hegman 2018-10-27 23:17:44 -07:00 committed by Will Thames
parent d5d18a995a
commit 303fa6b478
2 changed files with 5 additions and 3 deletions

View file

@ -28,7 +28,7 @@ author:
description: description:
- Use the OpenShift Python client to perform CRUD operations on K8s objects. - 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 - 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. - 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) - 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. - Authenticate using either a config file, certificates, password or token.
@ -116,7 +116,9 @@ EXAMPLES = '''
state: present state: present
src: /testing/deployment.yml 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: k8s:
state: present state: present
definition: "{{ lookup('file', '/testing/deployment.yml') }}" definition: "{{ lookup('file', '/testing/deployment.yml') }}"

View file

@ -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 - "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 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." 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 plugin or template lookup plugin, combined with the from_yaml filter, and pass the result to
I(resource_definition). See Examples below. I(resource_definition). See Examples below.
''' '''