Ansible
Ansible Documentation
yuyuyu
V2EX  ›  Ansible

ansible 如何控制 windows 后台运行 nginx?

  •  
  •   yuyuyu · May 6, 2017 · 6093 views
    This topic created in 3328 days ago, the information mentioned may be changed or developed.

    我使用下面的命令启动

    ansible web -m win_shell -a 'start nginx chdir=C:\\nginx-1.13.0'
    

    结果命令执行完返回后,windows 上没有 nginx 的进程,但 nginx 有生成 logs,感觉是刚启动完随着 ansible 的返回又被杀掉了 我看了 ansible 官方文档 http://docs.ansible.com/ansible/win_shell_module.html 下面有说“ WinRM will not return from a command execution until all child processes created have exited. Thus, it is not possible to use win_shell to spawn long-running child or background processes. Consider creating a Windows service for managing background processes.” 但我确实要启动 nginx 并且不希望用服务的方式,不然没办法 -s reload

    也尝试过运行一个 cmd 然后里面写 start nginx,还有自己写一个小程序去运行 nginx,都不行,要么是没有 nginx 进程,要么是 nginx 启动成功但 ansible 一直挂起没有返回

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5498 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 03:42 · PVG 11:42 · LAX 20:42 · JFK 23:42
    ♥ Do have faith in what you're doing.