I’m not understanding why its failing. I did everything that the tasks has asked for and even verified it.
Here is the task:
We already have an
inventoryfile under/home/thor/ansibledirectory onjump host. Create aplaybook.ymlunder/home/thor/ansibledirectory onjump hostitself.
Using the playbook, install
httpdweb server on all app servers. Additionally, make sure its service should up and running.Using
blockinfileAnsible module add some content in/var/www/html/index.htmlfile. Below is the content:
Welcome to XfusionCorp!
This is Nautilus sample file, created using Ansible!
Please do not modify this file manually!
The
/var/www/html/index.htmlfile’s user and groupownershould beapacheon all app servers.The
/var/www/html/index.htmlfile’s permissions should be0777on all app servers.
Note:i. Validation will try to run the playbook using command
ansible-playbook -i inventory playbook.ymlso please make sure the playbook works this way without passing any extra arguments.ii. Do not use any custom or empty
markerforblockinfilemodule.
And i added screenshots of verification and of my playbook.
Here is my playbook
---
- name: Install Web Server
hosts: all
become: yes
tasks:
- name: Install httpd
ansible.builtin.dnf:
name: httpd
state: present
- name: Start and Enable httpd
ansible.builtin.service:
name: httpd
enabled: true
state: started
- name: Add index.html content
ansible.builtin.blockinfile:
path: /var/www/html/index.html
owner: apache
group: apache
mode: '0777'
create: yes
block: |
Welcome to XfusionCorp!
This is a Nautilus sample file, created using Ansible!
Please do not modify this file manually!
```
Someone please assist
