Supervisorctl
Exit Code
自從這個 PR (v4) 開始, supervisorctl status <process> 會跟 process 的狀態有關。
基本上來說非零則意味著不是 RUNNING
Ansible restart 兩次
Ansible supervisorctl module 的 state: restarted 會先 supervisorctl update 再 restart,而 update 本身就會重啟 config 有變的 program。
所以 supervisor config 改了又用 restarted,app 會被連續重啟兩次。
依 config 變動分開處理:
yaml
- name: Apply supervisor config (restarts app)
become: true
shell: supervisorctl update app
when: supervisor_conf.changed
- name: Restart app
become: true
shell: supervisorctl restart app
when: app_conf.changed and not supervisor_conf.changed