nmcli errors when adding more than one DNS server

The documentation states that multiple DNS entries should be formatted like so:


|
A list of upto 3 dns servers, ipv4 format e.g. To add two IPv4 DNS server addresses: [“8.8.8.8 8.8.4.4”]

Following that example, I get the error: “Error: failed to modify ipv4.dns: invalid IPv4 address ‘["216.xxx.xxx.xxx’.\n”


|

  • | - |

The documentation provides examples that include:

# To add two IPv4 DNS server addresses:
-nmcli: conn_name=my-eth1 dns4=["8.8.8.8", "8.8.4.4"] state=present

When I follow that example, I end up with an extra params error and template expressions erro:
ERROR! this task 'nmcli' has extra params, which is only allowed in the following modules...
Always quote template expression brackets when they start a value...

---
- hosts: redacted
  user: redacted
  sudo: yes
  pre_tasks:
  - nmcli: 'conn_name="{{ ansible_interfaces[1] }}" 
              state=present 
              type=ethernet 
              ip4=redacted 
              gw4=redacted 
              dns4=["redacted", "8.8.8.8", "redacted"]'

I've tried swapping the quotes around, with singles inside and doubles outside, and got the same extra params error. I haven't cracked the syntax just right yet. 

I'd love a pointer for what to try next.

This error appears to be related to the other issue I was having, since the error spits out the same odd jibberish. I suspect line 505 of the code is related, meaning the dictionary is not reading/parsing cleanly:

dstr+=“%s: %s\n” % ( key, str_val)

Anyway, for the DNS entries, it seemed to be happy with dns4="8.8.8.8, 216.125.253.131, 8.8.4.4" which is a hybrid of the two examples in the documentation.

However, I have lost my connection to the machine until I am on campus tomorrow or Wednesday, so I am going to be working on something else for now.