I am pretty much beginner with ansible. I am trying to migrate linux scripts to perform a remote server startup using the nohup command and it does not work properly. The ansible results state change: true, but when I check if the process is up, it doesn't. Thus, I have to restart it manually.
Thanks for your help.
Here what I am doing:
- name: "Performing remote startup on server {{ SERVER }}"
command: nohup {{ JAVA_HOME }}/bin/java {{ DYNATRACE_AGENT_REUS }} -jar -Dengine={{ ENGINE_NAME }} name-{{ ENGINE_JAR_VERSION }}.jar --server.port={{ ENGINE_PORT }} >{{ CONSOLE_LOG }} 2>&1 &
args:
chdir: "{{ SOMEVAR_HOME }}"
async: 75
poll: 0
register: out
- debug:
msg: '{{ out }}'
Results:
TASK [Performing remote startup on server] ***********************************************************************************************************************************************************************************
changed: [servername]
TASK [debug] ********************************************************************************************************************************************************************************************************************************
ok: [servername] => {
"msg": {
"ansible_job_id": "160551828781.28405",
"changed": true,
"failed": false,
"finished": 0,
"results_file": "/home/admindirectory/.ansible_async/160551828781.28405",
"started": 1
}
}