Hey, you can use the k8s module for this purpose. You can try something like this:
- name: Read file from the Ansible controller file system.
k8s:
state: present
definition: "{{ lookup('file', '/path-to-file/deployment.yml') }}"
If You want your task to fail on errors, you can enable it by adding the following line
validate:
fail_on_error: yes