4:14841fed8ac3 default tip
Anton Shestakov <av6@dwimlabs.net>, Mon, 28 Sep 2020 11:31:48 +0800
hgweb: run on Python 3

previous change 3:697ce0fdd884

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 Lighttpd and uWSGI being installed. It's
# recommended to install them in separate lighttpd and uwsgi roles, not in
# pre_tasks like in this example playbook.
- name: Install Lighttpd
apt:
update_cache: yes
cache_valid_time: 3600
package: lighttpd
state: present
- name: Install uWSGI
apt:
package:
- uwsgi
- uwsgi-plugin-python3
state: present
roles:
# - role: lighttpd
# tags: [lighttpd]
# - role: uwsgi
# tags: [uwsgi]
- role: hgweb
tags: [hgweb]
handlers:
# NOTE: hgweb role notifies two handlers:
# - restart uwsgi
# - restart lighttpd
# Naturally, the handlers are not defined in the role itself, so this
# example playbook includes them here.
- name: restart uwsgi
service:
name: uwsgi
state: restarted
- name: restart lighttpd
service:
name: lighttpd
state: restarted
...
# NOTE: how to test that it works correctly (also see the note about DNS):
# curl -I http://hg.mydomain/
# curl -I http://hg.mydomain/static/mercurial.js
# then check /var/log/uwsgi/app/50-hgweb.log for problems
# make sure it doesn't see requests /static/ (Lighttpd should handle them)