On 23/12/2021 09:44, 'Jitender J' via Ansible Project wrote:
Hi

Below is the piece of code I am trying to execute, it is running fine over 500 
nodes but there are some hosts in different environments where ansible not 
executing the code inside the shell module

Problems with arbitrary shell scripts is not related to Ansible IMHO.

Regards
          Racke

just passing the code without any error/output
#################################################################
  hosts: smca
  # tags: Node_check
   gather_facts: no
   user: ops
   tasks:

     - name: Executing Cluster Node Count Check On CA
       shell: |
         node_pipe_sepertated=`echo "{{ Nodes }}"|tr ',' '|'`
         c_id1=`for i in "$node_pipe_sepertated" ;do /sc/bin/smconfd smsm 
|egrep $i|awk '{print $(NF-5 )}';done`
         c_id=`echo "$c_id1"|tr -s ' ' '\n'|sort -u|tr -s '\n' ' '`
         echo "c id is $c_id"
          for i in ${c_id[@]};
          do
            echo "$i"
            Count=`/sc/bin/smconfd smsm |awk -v a=$i '$10 == a {print $NF}'|awk 
-F'.logs' '{print $1}'|wc -l`
            instances=`/sc/bin/smconfd smsm |awk -v a=$i '$10 == a {print 
$NF}'|awk -F'.logs' '{print $1}'`
            echo -e "\e[34m##### Nodes In Cluster #####\e[0m"

            if [ "$Count" -lt 2 ];then
               echo -e "\e[1;31mCRITICAL: Number Of Nodes in Cluster $Count 
\e[0m"
               echo "$instances"
               exit 2
            else
              echo -e "\e[1;32mOk: Number Of Nodes in Cluster $Count \e[0m"
              echo "$instances"

            fi
            echo " "
          done
       args:
        executable: /bin/bash
       ignore_errors: true
       when: smca_role==  true
###########################################


On Thu, Dec 23, 2021 at 2:00 PM Dick Visser <[email protected] 
<mailto:[email protected]>> wrote:

    That's almost zero information.
    Provide a full playbook and any other relevant information.


    On Thu, 23 Dec 2021 at 09:27, 'Jitender J' via Ansible Project 
<[email protected] <mailto:[email protected]>> 
wrote:

        Hi Team,

        Need you help on below issue

        I am facing issue where code inside shell module is not getting 
executed over some remote server, ansible just passing the got without 
executing without any error,

-- 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] 
<mailto:[email protected]>.
        To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/40b39be1-57a3-4842-86c4-cdc638a87845n%40googlegroups.com
 
<https://groups.google.com/d/msgid/ansible-project/40b39be1-57a3-4842-86c4-cdc638a87845n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- Sent from a mobile device - please excuse the brevity, spelling and punctuation.

-- 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] 
<mailto:[email protected]>.
    To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOGo1jjaWeMJ4%3DCeB0p7U3cY0%3DF4OsDgudTeTt7VMoTYA%40mail.gmail.com
 
<https://groups.google.com/d/msgid/ansible-project/CAL8fbwOGo1jjaWeMJ4%3DCeB0p7U3cY0%3DF4OsDgudTeTt7VMoTYA%40mail.gmail.com?utm_medium=email&utm_source=footer>.



--
*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 
[email protected] 
<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMO4JZvLGMqY29JtWBSgkGi9_8ZVijv6HwXWjevm%2BQCWOfoTYw%40mail.gmail.com
 
<https://groups.google.com/d/msgid/ansible-project/CAMO4JZvLGMqY29JtWBSgkGi9_8ZVijv6HwXWjevm%2BQCWOfoTYw%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3a8becfa-b4d9-1681-7a50-cf03a694c3d7%40linuxia.de.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to