ubuntu - ansible 无法重新启动 php5-fpm

标签 ubuntu ansible

我有一个处理程序试图重新启动 php5-fpm:

handlers:
    - name: restart nginx
      service: name=nginx state=restarted
    - name: restart php5fpm
      service: name=php5-fpm state=restarted
    - name: restart mysql
      service: name=mysql state=restarted

和一个调用处理程序的通知:
- name: copy php.ini to php config folder
  template: src=php.ini.j2 dest=/etc/php5/fpm/php.ini owner=root group=root mode=0644
  changed_when: true
  notify:
    restart php5fpm

这失败了:
RUNNING HANDLER [restart php5fpm] **********************************************
fatal: [host01]: FAILED! => {"changed": false, "failed": true, "msg": "stop: Rejected send message, 1 matched rules; type=\"method_call\", sender=\":1.313\" (uid=1002 pid=18082 comm=\"stop php5-fpm \")     interface=\"com.ubuntu.Upstart0_6.Job\" member=\"Stop\" error name=\"(unset)\" requested_reply=\"0\" destination=\"com.ubuntu.Upstart\" (uid=0 pid=1 comm=\"/sbin/init \")\nstart: Rejected send message, 1 matched rules; type=\"method_call\", sender=\":1.314\" (uid=1002 pid=18086 comm=\"start php5-fpm \") interface=\"com.ubuntu.Upstart0_6.Job\" member=\"Start\" error name=\"(unset)\" requested_reply=\"0\" destination=\"com.ubuntu.Upstart\" (uid=0 pid=1 comm=\"/sbin/init \")\n"}

但是,在 VM 上重新启动服务没有问题:
vagrant@vagrant-ubuntu-trusty-64:~$ sudo service php5-fpm restart
php5-fpm stop/waiting
php5-fpm start/running, process 18984

我已经阅读了以下内容:
Nginx cannot restart via Ansible

而且我知道 php5-fpm 和 ubuntu 14.04 的错误 ansible 1.9.1 错误,所以我已经将我的 ansible 更新为
$ ansible --version
ansible 2.0.0.2
    config file = /Users/myUser/vagrant/test/ansible.cfg
    configured module search path = Default w/o overrides

最佳答案

我遇到了完全相同的问题,这是我的解决方法:

handlers:
 - name: restart php5fpm
   command: service php5-fpm restart

希望对你有帮助

关于ubuntu - ansible 无法重新启动 php5-fpm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38421765/

相关文章:

bash - 每次创建新用户时执行 shell 脚本

git - 为来自 Ubuntu 的现有文件创建一个新的 BitBucket 存储库

ssh - Ansible 配置错误!无法使用 SSH 密码代替 key

bash - 如何在 Ansible Jinja2 (.j2) 模板中指定 "if else"语句?

url - 等待几分钟以检查 URL 是否响应

linux - egrep AND 多个模式的条件不起作用

linux - 如何在 Linux Ubuntu 上重置 yakuake 配置?

python - 当我 easy_install greenlet 时,我得到 "error: Setup script exited with error: command ' gcc' failed with exit status 1 "

ansible - 如何重用我编写的 ansible 角色?

linux - 在ansible中获取root权限