Re: [⚠️] Re: [ansible-project] Facing Issue Ansible Summary

2021-12-20 Thread Stefan Hornburg (Racke)

On 20/12/2021 15:44, 'Jitender J' via Ansible Project wrote:

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



On Mon, Dec 20, 2021 at 8:06 PM Antony Stone mailto:antony.st...@ansible.open.source.it>> wrote:

On Monday 20 December 2021 at 15:34:02, 'Jitender J' via Ansible Project
wrote:

 > 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.

-- 
What do you call a dinosaur with only one eye?  A Doyouthinkesaurus.


                                                    Please reply to the 
list;
                                                          please *don't* CC 
me.



--
*Regards,
*
*Jitender*

--
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 
ansible-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMO4JZs_XPhYKoHNqmjTYzLVWzCo%3Dr2v4o9VWYAomquz5nNXsA%40mail.gmail.com
 
.



--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.


--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eab28ae1-9394-e273-1e36-b8079523ef1e%40linuxia.de.


OpenPGP_signature
Description: OpenPGP digital signature


Re: [⚠️] Re: [ansible-project] Facing Issue Ansible Summary

2021-12-20 Thread 'Jitender J' via Ansible Project
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
#

On Mon, Dec 20, 2021 at 8:06 PM Antony Stone <
antony.st...@ansible.open.source.it> wrote:

> On Monday 20 December 2021 at 15:34:02, 'Jitender J' via Ansible Project
> wrote:
>
> > 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.
>
> --
> What do you call a dinosaur with only one eye?  A Doyouthinkesaurus.
>
>Please reply to the
> list;
>  please *don't* CC
> me.
>


-- 

*Regards,*
*Jitender*

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMO4JZs_XPhYKoHNqmjTYzLVWzCo%3Dr2v4o9VWYAomquz5nNXsA%40mail.gmail.com.


Re: [ansible-project] Facing Issue Ansible Summary

2021-12-20 Thread Antony Stone
On Monday 20 December 2021 at 15:34:02, 'Jitender J' via Ansible Project 
wrote:

> 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.

-- 
What do you call a dinosaur with only one eye?  A Doyouthinkesaurus.

   Please reply to the list;
 please *don't* CC me.