Hi,

Any ideas where I am going wrong here.

I have a web server tasks which uses shell to start apache no problem:

- hosts: webservers
    remote_user: root
    become_user: test
    become: True
    tasks:
      - name: Task18 - Start webservers back up
        shell: ./apache/bin/apachectl start
    tags:
      - startweb

I have made a similar task to try start node for which I pass in the same 
'start' arguement

- hosts: nodes
    remote_user: root
    become_user: test
    become: True
    tasks:
      - name: Task18 - Start node back up
        shell: ./***/***/init.d/etc.d/control.postcodesio.nodejs.sh start
    tags:
      - startnode

This task fails with : 

 "msg": "non-zero return code", "rc": 127, "start": "2020-09-02 
19:07:49.395993", "stderr": "sh: control.postcodesio.nodejs.sh: No such 
file or directory",

This script definitely exists in this location and works if triggered 
manually:

./control.postcodesio.nodejs.sh start
Starting NodeJS: 26182
 NodeJS instance running


I have tried a different approach but I still get the same  No such file or 
directory

 tasks:
      - name: Task17 - start nodejs - Step1 of 4 - Change Directory
        command: cd /apps/was/init.d/etc.d/

      - command: "ls /apps/was/init.d/etc.d/"
        register: dir_out
    
      - debug: var={{item}}
        with_items: dir_out.stdout_lines

The out put of this confirms the presence of the script so i really don't 
understand why it says it can't be found?

:
TASK [Task17 - start nodejs - Step1 of 4 - Change Directory] 
***********************************************************************************************************************************************
changed: [vm019743.bskyb.com]
changed: [vm019742.bskyb.com]

TASK [command] 
*********************************************************************************************************************************************************************************************
changed: [vm019742.bskyb.com]
changed: [vm019743.bskyb.com]

TASK [debug] 
***********************************************************************************************************************************************************************************************
ok: [hostname] => (item=dir_out.stdout_lines) => {
    "changed": false,
    "dir_out.stdout_lines": [
        "control.apache.sh",
        "control.postcodesio.nodejs.sh"
    ],
    "item": "dir_out.stdout_lines"
}
ok: [hostname] => (item=dir_out.stdout_lines) => {
    "changed": false,
    "dir_out.stdout_lines": [
        "control.apache.sh",
        "control.postcodesio.nodejs.sh"
    ],
    "item": "dir_out.stdout_lines"
}

TASK [Task17 - start nodejs - Step2 of 4 - execute startup script] 
*****************************************************************************************************************************************
fatal: [hostname]: FAILED! => {"changed": true, "cmd": ["sh", 
"control.postcodesio.nodejs.sh", "start"], "delta": "0:00:00.007772", 
"end": "2020-09-02 19:07:49.098795", "msg": "non-zero return code", "rc": 
127, "start": "2020-09-02 19:07:49.091023", "stderr": "sh: 
control.postcodesio.nodejs.sh: No such file or directory", "stderr_lines": 
["sh: control.postcodesio.nodejs.sh: No such file or directory"], "stdout": 
"", "stdout_lines": []}



Any ideas much appreciated.


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/f57330d7-cf54-4dd2-a648-ac1b7bdec967n%40googlegroups.com.

Reply via email to