Ansible playbook fails with: no test named 'success' I have an Ansible Playbook that is used to configure WSL on my Windows Laptop, having rebuilt my laptop recently I needed to run the playbook again, however it is failing with the following message:

The conditional check 'aptitude_installed is success' failed. The error was: no test named 'success'
  line 1

The error appears to have been in '/mnt/c/source/richardslater/workstation-setup/wsl/plays/wsl.yml': line 15, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:

  - name: ensure aptitude is installed
    ^ here


The context from the playbook is:

tasks:
- name: check if aptitude is installed
  shell: dpkg-query -W -f='${Status}' aptitude | grep 'install ok installed'
  register: aptitude_installed
  failed_when: no
  changed_when: no

- name: ensure aptitude is installed
  command: apt-get -y install aptitude warn=False
  when: aptitude_installed is success


The output of dpkg-query -W -f='${Status}' aptitude | grep 'install ok installed' is:

install ok installed


and ansible --version

ansible 2.2.1.0
  config file = /mnt/c/source/richardslater/workstation-setup/wsl/plays/ansible.cfg
  configured module search path = Default w/o overrides


and pip show jinja2

Name: Jinja2
Version: 2.8
Summary: A small but fast and easy to use stand-alone template engine 
written in pure python.
Home-page: http://jinja.pocoo.org/
Author: Armin Ronacher
Author-email: armin.ronacher@active-4.com
License: BSD
Location: /usr/lib/python2.7/dist-packages
Requires: MarkupSafe


I'm not entirely sure how it ever worked, either that or something changed since I built this playbook, any ideas on how to fix?
You use pretty old ansible, maybe worth to try a new one. Although tests "succeeded" and "success" should be in 2.2 too.

But main problem I think it's failed_when: no in your task. It makes test when: aptitude_installed is success completely useless, it will be always true because failed_when: no marks all tasks as successful.

If you don't want to stop on task, but still to have an idea how it went, you should use ignore_errors: true, not failed_when: no. With ignore_errors: true you can both continue your playbook and inspect a real tasks results.