Ansible task to read definition file from the Ansible controller file system.

0 votes
I'm working on a small project for my college. I've to automate the entire process using Ansible. Most of it is done. This section says that I need to read a definition file from the Ansible controller file system. How do I write a playbook for it?
Jun 11 in Ansible by Laksha
57 views

1 answer to this question.

0 votes

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
answered Jun 11 by Babita

Related Questions In Ansible

0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
152 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Ansible playbook to wget a file

Hey @Celia, one recommendation, try not using ...READ MORE

answered Jan 16 in Ansible by Vaishu
1,179 views