Solution: Ansible for Linux
Look at the solution to the previous exercise.
We'll cover the following...
---
- name: exercise
hosts: all
vars:
myfile: "/etc/motd"
tasks:
- name: creating a text file
ansible.builtin.copy:
dest: "{{ myfile }}"
content: |
Example of
Message of the Day
owner: "root"
group: "root"
mode: "0644"
Code to create the motd file
Explanation
For the
create_file.ymlfile:Line 2: We write the play named
exercise.Line 3: We specify the host
allfor the target hosts of execution.Lines ...
Ask