Hi guys,
in my opinion, I completed the task successfully. However, I do get the error that /root/facts.txt does not exist or does not contain the correct data on stapp01.
In my screenshot you can see that the file exists and that the content is correct too!
I checked the files on stapp02 and 03 and they are absolutely the same. Heres my playbook:
-
name: Setup Apache web server and system facts page
hosts: all
become: yes
gather_facts: yestasks:
-
name: Install httpd
yum:
name: httpd
state: present -
name: Create facts.txt with system architecture info
blockinfile:
path: /root/facts.txt
create: yes
block: |
System Information
==================
Architecture: {{ ansible_architecture }} -
name: Copy facts.txt to index.html
copy:
src: /root/facts.txt
dest: /var/www/html/index.html
remote_src: yes
owner: root
group: root
mode: ‘0644’ -
name: Start and enable httpd service
service:
name: httpd
state: started
enabled: yes
-

