It looks like this is working, but I get an error. Does anyone know the proper way to do this? Thanks!
- name: configure hostname
ios_config:
commands:
- ip domain-name {{ domain_name }}
when: not ansible_net_config | search("(ip domain-name {{ domain_name }}|ip domain name {{ domain_name }})")
[WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: not ansible_net_config | search(“(ip domain-name {{ domain_name }}|ip domain name {{
domain_name }})”)