--- - name: Verify hosts: all gather_facts: false tasks: - name: Read the stub version ansible.builtin.command: argv: [/usr/local/bin/stubd, version] register: check_version changed_when: false - name: Stat the staged file and the backup ansible.builtin.stat: path: "{{ check_path }}" loop: [/usr/local/bin/stubd.new, /usr/local/bin/stubd.bak] loop_control: loop_var: check_path register: check_leftovers - name: Read the stub unit ansible.builtin.systemd: name: stubd register: check_unit - name: The preview changed nothing and left the service down ansible.builtin.assert: that: - check_version.stdout == 'stubd version v1.0.0' - check_leftovers.results | selectattr('stat.exists') | list | length == 0 - check_unit.status.ActiveState in ['inactive', 'failed'] quiet: true