I am reading a yaml file, and trying to count the number of lines. It works for the file originally created, but when I add/remove entries in/from the yaml file, the line count sticks to what it was originally.
- name: reading golden output
shell:
cat "{{ file }}"
register: golden_output
- set_fact:
len1="{{ golden_output | count }}"
- debug: var=len1
How do I make this task update the count, and where did I possibly go wrong?
This worked fine for me: len1="{{ golden_output.stdout_lines | count }}"