I have some code checking for the existence of something. If it has 2 lines it means the post exists. Can I register the variable from the check into a boolean immediately in the first task, rather than needing to cast it in the second? My current solution:
- name: Check if home page has been created
sudo_user: www-data
shell: wp post list --post_type=page --post_title=Home --post_status=publish
chdir={{wordpress_path}}
register: is_homepage_created
- name: Booleanize homepage check
set_fact:
is_homepage_created={{is_homepage_created.stdout_lines|length >= 2}}