lineinfile quoting issues

Hi

I have this task:

`

  • name: Edit DHCP Client settings
    lineinfile: dest=/etc/dhcp/dhclient.conf line={{ item }} state=present
    with_items:
  • supersede domain-search “example.com”,“local.example.com”;
  • default domain-name “example.com”;
    `

And I always get this error:

failed: [127.0.0.1] => (item=supersede domain-search “example.com”,“local.example.com:wink: => {“failed”: true, “item”: “supersede domain-search "example.com","local.example.com";”}
msg: this module requires key=value arguments ([‘dest=/etc/dhcp/dhclient.conf’, ‘line=supersede’, ‘domain-search’, ‘example.com,local.example.com;’, ‘state=present’])
failed: [127.0.0.1] => (item=default domain-name “example.com:wink: => {“failed”: true, “item”: “default domain-name "example.com";”}
msg: this module requires key=value arguments ([‘dest=/etc/dhcp/dhclient.conf’, ‘line=default’, ‘domain-name’, ‘example.com;’, ‘state=present’])

I have tried to put whole line in quotes like this:

lineinfile: "dest=/etc/dhcp/dhclient.conf line={{ item }} state=present"

Also tried nested quotes like this:

`
with_items:

Also tried to escape double-quotes and single-quotes.

But still getting the same error. What is the correct way to put quotes here?

Thanks in advance
Edgars

Specify it this way

  • name: Edit DHCP Client settings
    lineinfile:
    dest: /etc/dhcp/dhclient.conf
    line: “{{ item }}”
    state: present
    with_items:
  • supersede domain-search “example.com”,“local.example.com”;
  • default domain-name “example.com”;

Thanks!
Michael