31:65daf0ee01ec
Anton Shestakov <av6@dwimlabs.net>, Sun, 27 Sep 2020 18:59:01 +0800
gunicorn: add .py extension to the config file name

next change 33:01477dfb1836
previous change 25:04213176ca62

playbook-example.yml

Permissions: -rw-r--r--

Other formats: Feeds:
---
- hosts: all
become: yes
vars:
hostname: mydomain
pre_tasks:
# NOTE: you probably don't want to run these pre_tasks on a real box. Just
# bear in mind that to be able to access hgweb from inside the box, you
# need to use the virtual host name (i.e. http://127.0.0.1/ won't work).
# So make sure you either have DNS records for hg.mydomain or it's in
# /etc/hosts.
- name: Set hostname
hostname:
name: '{{ hostname }}'
- name: Update /etc/hosts
lineinfile:
dest: /etc/hosts
line: '127.0.0.1 {{ hostname }} hg.{{ hostname }}'
# NOTE: hgweb role depends on Nginx and Supervisor being installed. It's
# recommended to install them in separate nginx and supervisor roles, not
# in pre_tasks like in this example playbook.
- name: Install Nginx
apt:
update_cache: yes
cache_valid_time: 3600
package: nginx-full
state: installed
- name: Disable default Nginx site
file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: Install Supervisor
apt:
package: supervisor
state: installed
roles:
# - role: nginx
# tags: [nginx]
# - role: supervisor
# tags: [supervisor]
- role: hgweb
tags: [hgweb]
handlers:
# NOTE: hgweb role notifies two handlers:
# - reload supervisor
# - restart nginx
# Naturally, the handlers are not defined in the role itself, so this
# example playbook includes them here.
- name: reload supervisor
shell: supervisorctl update
- name: restart nginx
service:
name: nginx
state: restarted
...
# NOTE: how to test that it works correctly (also see the note about DNS):
# curl -I http://hg.mydomain/
# will check hgweb pages, look for "200 Script output follows" status
# curl -I http://hg.mydomain/static/mercurial.js
# will check serving static files via Nginx, look for "200 OK" status