Finding a string within an stdout_lines array

I am trying to find whether a certain letter exists in an stdout_lines array.

I want the role to run if there is a ‘P’ found in the stdout_output.

The stdout_lines array looks like this “stdout”: “P\r\nA\r\nS\r\nI\r\n”, “stdout_lines”: [“P”, “A”, “S”, “I”]

myrole.yml

The error message is strange and I can not reproduce it in Ansible 2. But your condition still will not work, a list does not have a find method. In Ansible you can search a list with in:

roles:
  - all_servers
  - {role: production_server, when: '"P" in prod_fact'}