Below are the screenshots that I have done as part of this task : Ansible Lineinfile Module
@Inderpreet @Ayman @mmumshad
Error :
Here is the playbook.yml :
-
name: Install and configure apache web server
hosts: all
become: yes
become_user: root
tasks:-
name: Install apache web server
yum:
name: httpd
state: present -
name: Start apache web service
service:
name: httpd
state: started -
name: Creating index.html file
copy:
dest: /var/www/html/index.html
content: |
This is a Nautilus sample file, created using Ansible! -
name: Insert line at begin of file
lineinfile:
path: /var/www/html/index.html
line: ‘Welcome to xFusionCorp Industries!’
insertbefore: BOF -
name: Setting file permissions and owner
file:
path: /var/www/html/index.html
owner: apache
group: apache
mode: ‘0655’
-
Review this task and let me know the mistakes.
Also, if this is marked as success. Much appreciated !!!