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