I tried sending an .sh file to the remote machine with the needed commands and launching it:
#!/bin/bash
nohup bin/zookeeper-server-start.sh config/zookeeper.properties &
nohup bin/kafka-server-start.sh config/server.properties &
If i launch this .sh on the remote machine manually, it works but it doesn't work if i do it via Ansible playbook with this task:
Anything that i try manually works perfectly.
- name: starting service via .sh
shell: /path/to/remoteserver/sh_location/start_service.sh
I tried using command module instead. Doesn't work either.
When the service is on the remote server, i tried to launch with these tasks, they give the same output error (Connection Timed Out):
Before launching these tasks i have a daemon reload task, but doesn't matter which task, the first one that references any service will give the same error.
So if i launch the daemon reload task first, it will fail. If i skip this reload, the next one will fail.
- name: starting service via Systemd module
systemd:
name: zookeeper.service
no_block: yes
state: started
daemon_reload: yes
- name: starting services via service module
service:
state: started
name: zookeeper.service
- name: starting service launching a raw command on the remote server
shell: 'systemctl start zookeeper.service'
All these tasks where tested with kafka.service too.
(Kafka needs Zookeeper to be operative first)
Since i tried multiple times by different ways to get the same output error, i modified the timeout attribute inside ansible.cfg, increasing it from the default values.
This changes didn't fix the problem.
I also tried to start the service via sh having this command in the .sh file: systemctl start zookeeper.service but this doesn't get the job done.
The -vvvv option give this output:
fatal: [172.22.1.96]: FAILED! => {
"changed": true,
"cmd": "/home/borja/inventory/Innovery/Zookeeper/launchService.sh",
"delta": "0:00:25.044432",
"end": "2019-05-28 08:27:26.373093",
"invocation": {
"module_args": {
"_raw_params": "/home/borja/inventory/Innovery/Zookeeper/launchService.sh",
"_uses_shell": true,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"warn": true
}
},
"msg": "non-zero return code",
"rc": 1,
"start": "2019-05-28 08:27:01.328661",
"stderr": "Failed to start zookeeper.service: Connection timed out\nSee system logs and 'systemctl status zookeeper.service' for details.",
"stderr_lines": [
"Failed to start zookeeper.service: Connection timed out",
"See system logs and 'systemctl status zookeeper.service' for details."
],
"stdout": "",
"stdout_lines": []
}