ansible无法重启php5-fpm

时间:2016-07-17 13:30:15

标签: 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"}

虽然虚拟机上的服务重启没有问题:

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

我知道bug ansible 1.9.1 bug whit php5-fpm和ubuntu 14.04,所以我已经将我的ansible更新为

$ ansible --version
ansible 2.0.0.2
    config file = /Users/myUser/vagrant/test/ansible.cfg
    configured module search path = Default w/o overrides

1 个答案:

答案 0 :(得分:3)

我遇到了完全相同的问题,这是我的工作:

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

希望它能帮到你