Add example usage of from_yaml_all (#505)

Add example usage of from_yaml_all

Depends-On: #513
SUMMARY
Sometimes one might want to use a single YAML file that contains multiple Kubernetes definitions. This PR updates the documentation to provide a simple example of how to accomplish that.
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
k8s
ADDITIONAL INFORMATION
I have not tested this solution against other modules, simply because I did not have use-case for those.

Reviewed-by: Mike Graves <mgraves@redhat.com>
This commit is contained in:
Mauricio Teixeira
2022-09-21 09:51:54 -04:00
committed by GitHub
parent 5e48c6973c
commit 08596fd05b
2 changed files with 11 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
---
trivial:
- add example usage for from_yaml_all (https://github.com/ansible-collections/kubernetes.core/pull/505).

View File

@@ -232,6 +232,14 @@ EXAMPLES = r"""
state: present
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"
- name: >-
(Alternative) Read definition file from the Ansible controller file system.
In this case, the definition file contains multiple YAML documents, separated by ---.
If the definition file has been encrypted with Ansible Vault it will automatically be decrypted.
kubernetes.core.k8s:
state: present
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml_all }}"
- name: Read definition template file from the Ansible controller file system
kubernetes.core.k8s:
state: present