On 04.04.2019 09:47, Kunalsing Thakur wrote:
- name: Logging into pulp
  shell: pulp-admin login -u admin -p admin

- name: searching the rpm into {{ reponame }} repo
  shell: pulp-admin rpm repo content rpm --repo-id={{reponame}} --match
'filename={{ item }}'
  loop: "{{ rpmname | default([]) }}"
  register: pulp
  when: search is defined
  failed_when: pulp.stdout == "\e[0m"

Also i tried to use this one.

But ansible task will pass without fail.

This is the correct syntax.

The reason it doesn't work can be many thing and the trial and error might be you best option.


Your backslash in failed_when is probably taken as an escape.
- So try double backslash to escape the the backslash.
- Try changing to single quotes instead of double(with and without double backslashes)


Alternative is to just check for partial match(leave out the backslash).

  failed_when: "'e[0m' in pulp.stdout"


If that will not work you have a lot of filter that can do regexp that you can look into.


--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f2e9f828937956a3e5d7fbddae81a766%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to