I am using the dig command in an ansible.builtin.command and storing the results to the variable result. One of my until tests is result.stdout_lines|length >= 3 as we are waiting until as least 3 results are available. I also want to ensure that every line is an IPv4 address but the list length is unknown. Sometimes it will be 3 lines and sometimes it will be more.
I am trying to figure out how I can perform an until test on every item in a list when we don't know how long the list is.
Here's the task so far:
- name: Get database hosts # noqa no-changed-when
ansible.builtin.command: dig @127.0.0.1 -p 8600 +short db-addr.service.consul
register: result
until: result.stdout_lines|length >= 3
delay: 15
retries: 40