I’m using ansible to deploy Ray cluster. I’m initializing head node as following:
- name: Start Ray on head node ansible.builtin.command: ray start --head --port=6379 environment: PATH: /opt/anaconda3/bin
register: result
I printed the result and it looks fine. But when I run “ray status” in bash, it shows “Could not find any running Ray instance” error. Also, I tried typing “ray start --head --port=6379” directly in bash, everything is fine.
So why these give different result? What’s the difference between the bash that I use and the one ansible.builtin.command uses?
It is almost exactly like the command module but runs the command through a shell (/bin/sh) on the remote node.
From command docs:
The command(s) will not be processed through the shell, so variables like $HOME and operations like “<”, “>”, “|”, “;” and “&” will not work. Use the shell module if you need these features.
I'm using ansible to deploy Ray cluster. I'm initializing head node as following:
/ - name: Start Ray on head node/
/ ansible.builtin.command: ray start --head --port=6379/
/ environment: /
/ PATH: /opt/anaconda3/bin/
/ register: result/
I printed the result and it looks fine. But when I run "ray status" in bash, it shows "Could not find any running Ray instance" error. Also, I tried typing "ray start --head --port=6379" directly in bash, everything is fine.
So why these give different result? What's the difference between the bash that I use and the one ansible.builtin.command uses?
I think the "command" module doesn't use a shell at all, it executes the command from a Python skript.
That also means it doesn't read any of the bash configuration files, thus relevant environment variables
might be missing. Also check whether the task above uses the same user as the direct bash invocation.