Solution: Ansible Language
Look at the solution to the previous exercise.
We'll cover the following...
DATE: {{ ansible_date_time.date }} vCPU: {{ ansible_processor_vcpus }} RAM: {{ ansible_memtotal_mb }} Created by Ansible {{ ansible_version.string }}
Code for creating a resource usage text report
Explanation
For the
report.yml
playbook file:Line 2: We write the play named
exercise
.Line 3: We specify the
all
host for the target hosts of execution.Lines 4–5: We create a variable named
myfile
with the value"/usercode/report.txt"
....