mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-07-28 10:24:45 +00:00
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:
committed by
GitHub
parent
5e48c6973c
commit
08596fd05b
3
changelogs/fragments/505-add-from-yaml-all-example.yml
Normal file
3
changelogs/fragments/505-add-from-yaml-all-example.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
trivial:
|
||||||
|
- add example usage for from_yaml_all (https://github.com/ansible-collections/kubernetes.core/pull/505).
|
||||||
@@ -232,6 +232,14 @@ EXAMPLES = r"""
|
|||||||
state: present
|
state: present
|
||||||
definition: "{{ lookup('file', '/testing/deployment.yml') | from_yaml }}"
|
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
|
- name: Read definition template file from the Ansible controller file system
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
state: present
|
state: present
|
||||||
|
|||||||
Reference in New Issue
Block a user