Ansible Lineinfile module


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

For me also its failed with same error.

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

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

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

    • name: Create a file and Add a line to a file
      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
      path: /var/www/html/index.html
      insertbefore: BOF
      line: ‘Welcome to xFusionCorp Industries!’



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