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
inventory
file under/home/thor/ansible
directory onjump host
. Create aplaybook.yml
under/home/thor/ansible
directory onjump host
itself.
Using the playbook, install
httpd
web server on all app servers. Additionally, make sure its service should up and running.Using
blockinfile
Ansible module add some content in/var/www/html/index.html
file. 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.html
file’s user and groupowner
should beapache
on all app servers.The
/var/www/html/index.html
file’s permissions should be0777
on all app servers.
Note:
i. Validation will try to run the playbook using command
ansible-playbook -i inventory playbook.yml
so please make sure the playbook works this way without passing any extra arguments.ii. Do not use any custom or empty
marker
forblockinfile
module.
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