9:855a89f33e5e default tip
Anton Shestakov <av6@dwimlabs.net>, Mon, 28 Sep 2020 21:30:03 +0800
hgweb: run on Python 3

previous change 8:d5f5d21b8880

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 Apache httpd (and mod_wsgi) being installed.
# It's recommended to install them in a separate apache2 role, not in
# pre_tasks like in this example playbook.
- name: Install Apache httpd
apt:
update_cache: yes
cache_valid_time: 3600
package:
- apache2
- libapache2-mod-wsgi-py3
state: present
- name: Enable mod_wsgi
apache2_module:
state: present
name: wsgi
- name: Disable default Apache httpd site
file:
path: /etc/apache2/sites-enabled/000-default.conf
state: absent
roles:
# - role: apache2
# tags: [apache2]
- role: hgweb
tags: [hgweb]
handlers:
# NOTE: hgweb role notifies this handler:
# - restart apache2
# Naturally, the handler is not defined in the role itself, so this example
# playbook includes it here.
- name: restart apache2
service:
name: apache2
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 Apache httpd, look for "200 OK" status