# Help: Can't Update ifcfg-eth0

**URL:** <https://forum.ansible.com/t/help-cant-update-ifcfg-eth0/31562>\
**Category:** Ansible Project\
**Created:** [October 29, 2019, 7:07pm UTC](https://forum.ansible.com/t/help-cant-update-ifcfg-eth0/31562 "2019-10-29T19:07:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Love](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@Love](https://forum.ansible.com/u/Love)\
**Post date:** [October 29, 2019, 7:07pm UTC](https://forum.ansible.com/t/help-cant-update-ifcfg-eth0/31562/1 "2019-10-29T19:07:11Z")

</div>

Dear Experts,

Could you please let me know what’s missing in my code?

Requirement: Need to change Domain search order in my ifcfg-eth0 file across multiple servers.

Desired state is just to update the search order one time and don’t change if user executes same playbook multiple times, do let me know if you have any questions.

Code:

# Update search order in eth0

---

<div class="post-metadata">

**Author:** ![Wawrzek\_Niewodniczan](https://avatars.discourse-cdn.com/v4/letter/w/bbe5ce/32.png) [@Wawrzek\_Niewodniczan](https://forum.ansible.com/u/Wawrzek_Niewodniczan)\
**Post date:** [October 29, 2019, 7:37pm UTC](https://forum.ansible.com/t/help-cant-update-ifcfg-eth0/31562/2 "2019-10-29T19:37:38Z")

</div>

> Dear Experts,

[...]

> Requirement: Need to change Domain search order in my ifcfg-eth0 file across multiple servers.

[...]

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_items:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- {dest: '/tmp/ifcfg-eth0', regexp: '^DOMAIN=amer.com ham.am.com am.mds.com mds.com hmin.am.com', line: 'DOMAIN=ham.am.com amer.com am.mds.com mds.com hmin.am.com'}

What does happen if you shortened regexp to '^DOMAIN='?

Wawrzek

---

<div class="post-metadata">

**Author:** ![Love](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@Love](https://forum.ansible.com/u/Love)\
**Post date:** [October 29, 2019, 10:15pm UTC](https://forum.ansible.com/t/help-cant-update-ifcfg-eth0/31562/3 "2019-10-29T22:15:15Z")

</div>

Hi Wawrzek,

If the regexp is set to ‘^DOMAIN=’? then its syntax error and I cannot execute the playbook, if its set to ‘^DOMAIN=?’ then its adding appending a line at the end instead of replacing.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 29, 2019, 10:19pm UTC](https://forum.ansible.com/t/help-cant-update-ifcfg-eth0/31562/4 "2019-10-29T22:19:27Z")

</div>

Remove the question mark, that was part of of the sentence.  
So it just

'^DOMAIN='

---

<div class="post-metadata">

**Author:** ![Love](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@Love](https://forum.ansible.com/u/Love)\
**Post date:** [October 29, 2019, 10:44pm UTC](https://forum.ansible.com/t/help-cant-update-ifcfg-eth0/31562/5 "2019-10-29T22:44:42Z")

</div>

Excellent!! that did the trick…Thank you very much!
