# ansible regex with lineinfile module not updating all host

**URL:** <https://forum.ansible.com/t/ansible-regex-with-lineinfile-module-not-updating-all-host/27184>\
**Category:** Ansible Project\
**Created:** [April 4, 2018, 7:55am UTC](https://forum.ansible.com/t/ansible-regex-with-lineinfile-module-not-updating-all-host/27184 "2018-04-04T07:55:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rraka1002](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rraka1002](https://forum.ansible.com/u/rraka1002)\
**Post date:** [April 4, 2018, 7:55am UTC](https://forum.ansible.com/t/ansible-regex-with-lineinfile-module-not-updating-all-host/27184/1 "2018-04-04T07:55:08Z")

</div>

Esteemed Collegues, I have created a Playbook to replcae the Entry in a file using a `lineinfile` module, while i tried running it run and replace in entry on the one host while not on the another host, i don’t understand why? as it doesn’t report any error even on the debug mode. Do i need to have some another `regex` pattern.

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [April 4, 2018, 8:11pm UTC](https://forum.ansible.com/t/ansible-regex-with-lineinfile-module-not-updating-all-host/27184/2 "2018-04-04T20:11:13Z")

</div>

`You need to account for white space. Try:`  
` `

```auto
regexp: '^passwd:.*files ldap'

```

` `

---

<div class="post-metadata">

**Author:** ![rraka1002](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rraka1002](https://forum.ansible.com/u/rraka1002)\
**Post date:** [April 5, 2018, 3:49am UTC](https://forum.ansible.com/t/ansible-regex-with-lineinfile-module-not-updating-all-host/27184/3 "2018-04-05T03:49:12Z")

</div>

Ah! that works John! thnx a mile.
