Ansible Lineinfile module

@Inderpreet

can you check the validation on the lineInfile Module task? This is the second time I got the task, but failed this time. I double checked the results and it looks fine. The weird thing is when i check back on June 5th, that I got success on the lineInFile Module task the first time, it wasn’t in my task list anymore?

thank you. -Jenna [email protected]

For me also its failed with same error.

Anyone can check this. @Inderpreet. below is my playbook.

  • hosts: all
    become: yes
    become_user: root
    tasks:
    • name: Install httpd package on all application servers
      yum:
      name: httpd
      state: installed

    • name: Start httpd service
      service:
      name: httpd
      state: started
      enabled: true

    • name: Create a file and Add a line to a file
      lineinfile:
      path: /var/www/html/index.html
      line: “This is a Nautilus sample file, created using Ansible!”
      create: yes
      owner: apache
      group: apache
      mode: ‘0777’

    • name: Add a line to a file
      lineinfile:
      path: /var/www/html/index.html
      insertbefore: BOF
      line: ‘Welcome to xFusionCorp Industries!’


![image|685x117](upload://jsJMM0IUftyCGCE9VCtdzZV9erZ.png) 

![image|690x81](upload://oyIHY4qW41NG8vjQdPk15Q1A9Vt.png)

moved restart service at the end and “insertbefore: BOF” in both lineinfo task. its worked for me.