The simplified answer from the link I mentioned in the comment:
--- - hosts: centos-target gather_facts: no tasks: - shell: "(cd /; python -mSimpleHTTPServer >/dev/null 2>&1 &)" async: 10 poll: 0
Note the brackets in parentheses.
Update: in fact, you should be fine without async , just remember to redirect stdout:
- name: start simple http server in background shell: cd /tmp/www; nohup python -mSimpleHTTPServer </dev/null >/dev/null 2>&1 &
Konstantin suvorov
source share