use list instead of and to combine conditionals
- name: Add any insecure registrys to docker config
lineinfile: dest={{ docker_config_dir }}/docker regexp="^INSECURE_REGISTRY=" line="INSECURE_REGISTRY={% for reg in insecure_registrys %}--insecure-registry={{ reg }} {% endfor %}"
- when: insecure_registrys is defined and insecure_registrys|length > 0
+ when:
+ - insecure_registrys is defined
+ - insecure_registrys|length > 0
notify:
- restart docker
tags: configure
