On 12/07/2023 13:30, Dick Visser wrote:
Hii,


On Wed, 12 Jul 2023 at 12:53, Sameer Modak <[email protected]> wrote:

    Hi Todd,

    I tried to run script with shell module but it fails with below error,

    [kafka-3: FAILED! => {"changed": true, "cmd": "if pkill --signal 9 -f zookeeper.properties ; then\nsystemctl start confluent-zookeeper510\nelse\nexit 1\nfi\nsystemctl status confluent-zookeeper510\n", "delta": 
"0:00:00.034111", "end": "2023-07-12 10:31:58.344951", "failed_when_result": true, "msg": "non-zero return code", "rc": -9, "start": "2023-07-12 10:31:58.310840", "stderr": 
"", "stderr_lines": [], "stdout": "", "stdout_lines": []}

    fatal: [kafka-4]: FAILED! => {"changed": true, "cmd": "if pkill --signal 9 -f zookeeper.properties ; then\nsystemctl start confluent-zookeeper510\nelse\nexit 1\nfi\nsystemctl status confluent-zookeeper510\n", "delta": 
"0:00:00.032830", "end": "2023-07-12 10:31:59.744091", "failed_when_result": true, "msg": "non-zero return code", "rc": -9, "start": "2023-07-12 10:31:59.711261", "stderr": 
"", "stderr_lines": [], "stdout": "", "stdout_lines": []}

    ===========================================================================

    code:

    - name: Kill running java processes and start newly configured systemd

    throttle: 1

    #ignore_errors: yes

    any_errors_fatal: true

    shell: |

    if [ pkill --signal 9 -f zookeeper.properties ] ; then

    systemctl start confluent-zookeeper510; sleep 2; echo "stat" | nc localhost 
2181;st="$?" systemctl status confluent-zookeeper510 -l | grep -v ERRROR;et="$?"


I feel we're going down a rabbit hole trying to fight ill designed systemd 
units with shell hacks (which include typos? ERRROR instead of ERROR).
My approach would be to make sure the systemd unit is doing what it should do, 
and then rely on that to do its job....

Certainly!

Regards

         Racke


--
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/CAF8BbLZQ7v-K7vSnFkGsVYwm_6a9HO3f1Cf7r8yBM%2Bb_DQcj4A%40mail.gmail.com
 
<https://groups.google.com/d/msgid/ansible-project/CAF8BbLZQ7v-K7vSnFkGsVYwm_6a9HO3f1Cf7r8yBM%2Bb_DQcj4A%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
Automation expert - Ansible and friends
Linux administrator & Debian maintainer
Perl Dancer & conference hopper

--
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/782f4e8a-bc5f-5799-be22-8f9f66d9edb7%40linuxia.de.

Reply via email to