Solution: Reading a File with Ansible
Look at the solution to the previous exercise.
We'll cover the following...
---
- name: Exercise
hosts: all
vars:
myfile: "/proc/cpuinfo"
tasks:
- name: Get the content of the cpuinfo
ansible.builtin.slurp:
src: "{{ myfile }}"
register: file_details
- name: Display cpuinfo
ansible.builtin.debug:
msg: "{{ file_details.content | b64decode }}"Code to read the cpuinfo file