Ansible hangs on pumactl start

Ryan Grush asked:

I have a playbook to install puma on my ec2 instance and everything is fine except when I run bundle exec pumactl start at the the end it starts the server but the playbook hangs indefinitely.

Here is the Ansible task –

 - shell: /home/ubuntu/.rbenv/shims/bundle exec pumactl start
   args: 
     chdir: /home/{{ user }}/{{ app_name }}
     warn: no

Is there a way to avoid this?

My answer:


You forgot to daemonize puma, so it’s running in the foreground. Ansible has been waiting for it to exit. Add the -d option to the command.

Better yet, you should create a systemd unit to run puma as a service, and then start that service. Daemonizing is not required in that case, as systemd will handle everything.

BTW, it is best practice to use command instead of shell unless you actually need shell processing (which in this case you do not).


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.