Re: [ansible-project] Ansible "failed_when" not working as desired

2020-03-06 Thread Dick Visser
Why not use the uri module instead of fragile shell + curl ? On Fri, 6 Mar 2020 at 13:47, Rakesh Parida wrote: > Hi, > > I have a task as follows: > > - hosts: nodes > gather_facts: true > tasks: > - name: CurlCP Status > shell: "curl -Is -m 1 http://localhost:9113/cp/healthcheck;

Re: [ansible-project] Ansible "failed_when" not working as desired

2020-03-06 Thread Vladimir Botka
On Fri, 6 Mar 2020 04:46:58 -0800 (PST) Rakesh Parida wrote: > failed_when: "'200 OK' not in cp_status.stdout_lines" Try failed_when: cp_status.stdout_lines| select('search', '200 OK')| list| length == 0 HTH, -vlado --