Facing Issue Ansible Summary

Hi Team,

Facing a very strange issue, my failed task output getting swapped with another task, in summary, we have done some modification in the callback module but never saw like this before, any suggestion

My suggestion is to show us your playbook which can do this.

Antony.

Hi Antony,

Thanks for the mail, below is the playbook code snippet

Hi Antony,

Thanks for the mail, below is the playbook code snippet

##############################
- hosts: "{{ UI }}"
gather_facts: no
user: ops
tasks:
- name: Check total CPU cores
shell: |
cpu=`sysctl hw.model hw.machine hw.ncpu|grep hw.ncpu:`
echo "$cpu"|awk -F':' '{
if ($2 >= 5)
print "\033[32mOK:\033[0m" $0;
else
print $0, echo -e "\033[31m CRITICAL\033[0m" }'
register: err_cpu
failed_when: '"CRITICAL" in err_cpu.stdout'
args:
executable: /bin/bash
ignore_errors: true

\- name: Check total memory
  shell: |
    mem=\`echo "$\(sysctl \-n hw\.physmem\)/1024/1024/1024"|bc\`
    echo "$mem"|awk '\{
    if \($NF >= 48\)
     print "\\033\[32mOK:\\033\[0m" $0
    else
      print  $0,  echo \-e "\\033\[31m CRITICAL\\033\[0m" \}'
  register: err\_mem
  failed\_when: '"CRITICAL" in err\_mem\.stdout'
  args:
   executable: /bin/bash
  ignore\_errors: true

#############################

Why don't use ansible_facts instead of these horrible shell hacks?

Regards
         Racke