我希望我的 Ansible 剧本使用主管来启动运行我的 django 项目的 Gunicorn 服务器。我现在拥有的剧本完全运行,但是 Gunicorn 似乎并没有在完成后运行。这是当前的剧本:
---
- hosts: sorb
become: true
vars:
product: "sorb"
vars_files:
- "../../group_vars/sorb"
- "../../../../ansible/group_vars/base"
roles:
- role: base
min_mnt_size: 30
daemon_logs:
- nginx
logs:
- file: "{{ log_json }}"
category: python-json
- file: "{{ log_unhandled }}"
category: unhandled-output
cron:
condition: "{{ not_dev }}"
jobs:
- sessioncleaner
- role: offline # "offline" follows "base" to prevent alerts during deploy
- role: install_env #install dep to avoid creation errors
- role: pip_virtualenv #this installs pip reqs and the virtual env uses requirements.txt
- role: github
repositories: #clone in common and sorb from github
- "common"
- "sorb"
- role: gunicorn
- role: oefenweb.supervisor
- role: supervisor
templates:
- "../../../gunicorn/templates/supervisor/gunicorn"
- role: online
- role: done
这是 gunicorn 角色任务 main.yml:
---
- name: Render gunicorn.conf.py
template:
src: gunicorn/gunicorn.conf.py.j2
dest: "{{ gunicorn_config_path }}"
owner: "{{ nginx_user }}"
group: "{{ nginx_group }}"
mode: "{{ '0o666' if is_vbox else '0o655' }}"
notify: Restart Supervisor
谢谢!!