Posts disappear here... However, disregard. IMHO there is nothing wrong with "node server.js &" and I was just trying to figure out why this doesn't work with Ansible. I wasn't looking for a religious discussion.
[email protected] schrieb am Dienstag, 12. Oktober 2021 um 18:54:35 UTC+2: > On 12/10/2021 18:45, 'Neil Young' via Ansible Project wrote: > > ...even though it might not be the high level of "best practice" (in > fact you can read a lot of this Racke comments, especially with Ansible) - > and I'm surely aware of that - it is a legit shell command. > > > > Yes, but running a server through nohup is certainly bad practice. Nohup > is rather provided to prevent long running processes to be disrupted. > > There is no really good way to control the server when it is running. How > do you stop it for example? Restart it when it is crashed? Etc. > > And the shell called from Ansible doesn't have the same environment as > when you login as regular user. > > Regards > Racke > > > > > > Neil Young schrieb am Dienstag, 12. Oktober 2021 um 18:43:12 UTC+2: > > > > Thanks for the helpful comment. > > > > [email protected] schrieb am Dienstag, 12. Oktober 2021 um 18:42:33 > UTC+2: > > > > On 12/10/2021 17:28, 'Neil Young' via Ansible Project wrote: > > > Hmm. I must be making again something fundamentally wrong :) > > > > > > > Yes, you are trying to use Ansible as glorified shell *and* ignore all > the options to run a service properly (e.g. with systemd). > > > > Regards > > Racke > > > > > Trying to start a simple node server app into background > > > > > > > > > - name: Start server (run as non-privileged user) > > > tags: server > > > shell: | > > > nohup node server.js 2>&1 & > > > args: > > > chdir: my-server-dir > > > become: yes > > > become_user: "{{ non_root_user }}" > > > > > > This runs w/o problems. However, the service is not started... > > > > > > Running the same command from console works... > > > > > > It doesn't even run as "sudo" (if f I remove the "become" lines at the > end, my entire script runs as sudo) > > > > > > > > > > > > -- > > > 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] <mailto: > [email protected]>. > > > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/7a4f5cee-091b-444c-a265-0a584afadb3fn%40googlegroups.com > > < > https://groups.google.com/d/msgid/ansible-project/7a4f5cee-091b-444c-a265-0a584afadb3fn%40googlegroups.com> > > < > https://groups.google.com/d/msgid/ansible-project/7a4f5cee-091b-444c-a265-0a584afadb3fn%40googlegroups.com?utm_medium=email&utm_source=footer > > < > https://groups.google.com/d/msgid/ansible-project/7a4f5cee-091b-444c-a265-0a584afadb3fn%40googlegroups.com?utm_medium=email&utm_source=footer > >>. > > > > > > -- > > Ecommerce and Linux consulting + Perl and web application programming. > > Debian and Sympa administration. > > > > -- > > 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] <mailto: > [email protected]>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/c66e7fcc-3e8e-43b0-adb9-c31925a8f443n%40googlegroups.com > > < > https://groups.google.com/d/msgid/ansible-project/c66e7fcc-3e8e-43b0-adb9-c31925a8f443n%40googlegroups.com?utm_medium=email&utm_source=footer > >. > > > -- > Ecommerce and Linux consulting + Perl and web application programming. > Debian and Sympa administration. > > -- 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/6538e050-b972-4d89-95f3-050d81c44d1an%40googlegroups.com.
