--- a/roles/hgweb/handlers/main.yml Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/handlers/main.yml Mon Jun 27 16:30:20 2016 +0800
- command: make --directory /home/{{ user }}/hg/ local
+ command: make --directory /home/{{ hgweb_user }}/hg/ local
- become_user: '{{ user }}'
+ become_user: '{{ hgweb_user }}'
supervisorctl: name=hgweb state=restarted
--- a/roles/hgweb/tasks/appinstall.yml Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/tasks/appinstall.yml Mon Jun 27 16:30:20 2016 +0800
- name: Ensure required directories exist
- file: path=/home/{{ user }}/{{ item }}/ state=directory
+ file: path=/home/{{ hgweb_user }}/{{ item }}/ state=directory
- copy: src=.hgrc dest=/home/{{ user }}/.hgrc
+ copy: src=.hgrc dest=/home/{{ hgweb_user }}/.hgrc
-- name: Pull Mercurial {{ mercurial_rev }}
- hg: repo={{ mercurial_url }} dest=/home/{{ user }}/hg/ revision={{ mercurial_rev }}
+- name: Pull Mercurial {{ hgweb_mercurial_rev }}
+ hg: repo={{ hgweb_mercurial_url }} dest=/home/{{ hgweb_user }}/hg/ revision={{ hgweb_mercurial_rev }}
-- name: Pull Evolve {{ evolve_rev }}
- hg: repo={{ evolve_url }} dest=/home/{{ user }}/evolve/ revision={{ evolve_rev }}
+- name: Pull Evolve {{ hgweb_evolve_rev }}
+ hg: repo={{ hgweb_evolve_url }} dest=/home/{{ hgweb_user }}/evolve/ revision={{ hgweb_evolve_rev }}
- template: src={{ item }} dest=/home/{{ user }}/hgwebfiles/{{ item }}
+ template: src={{ item }} dest=/home/{{ hgweb_user }}/hgwebfiles/{{ item }}
- name: Copy requirements.txt
- copy: src=requirements.txt dest=/home/{{ user }}/hgwebfiles/requirements.txt
+ copy: src=requirements.txt dest=/home/{{ hgweb_user }}/hgwebfiles/requirements.txt
- name: Set up venv for gunicorn
- pip: requirements=/home/{{ user }}/hgwebfiles/requirements.txt state=latest virtualenv=/home/{{ user }}/hgwebfiles/venv/
+ pip: requirements=/home/{{ hgweb_user }}/hgwebfiles/requirements.txt state=latest virtualenv=/home/{{ hgweb_user }}/hgwebfiles/venv/
--- a/roles/hgweb/tasks/main.yml Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/tasks/main.yml Mon Jun 27 16:30:20 2016 +0800
+ user: name={{ hgweb_user }}
apt: pkg={{ item }} state=present
- include: appinstall.yml
- become_user: '{{ user }}'
+ become_user: '{{ hgweb_user }}'
- name: Add supervisor app
template: src=etc/supervisor/conf.d/hgweb.conf dest=/etc/supervisor/conf.d/hgweb.conf
-- name: Add {{ subdomain }}.{{ hostname }} Nginx site
- template: src=etc/nginx/sites-available/hgweb dest=/etc/nginx/sites-available/{{ subdomain }}.{{ hostname }}
+- name: Add {{ hgweb_subdomain }}.{{ hostname }} Nginx site
+ template: src=etc/nginx/sites-available/hgweb dest=/etc/nginx/sites-available/{{ hgweb_subdomain }}.{{ hostname }}
-- name: Enable {{ subdomain }}.{{ hostname }} Nginx site
- file: src=/etc/nginx/sites-available/{{ subdomain }}.{{ hostname }} dest=/etc/nginx/sites-enabled/50{{ subdomain }}.{{ hostname }} state=link
+- name: Enable {{ hgweb_subdomain }}.{{ hostname }} Nginx site
+ file: src=/etc/nginx/sites-available/{{ hgweb_subdomain }}.{{ hostname }} dest=/etc/nginx/sites-enabled/50{{ hgweb_subdomain }}.{{ hostname }} state=link
--- a/roles/hgweb/templates/etc/nginx/sites-available/hgweb Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/templates/etc/nginx/sites-available/hgweb Mon Jun 27 16:30:20 2016 +0800
- server unix:/home/{{ user }}/hgwebfiles/socket fail_timeout=0;
+ server unix:/home/{{ hgweb_user }}/hgwebfiles/socket fail_timeout=0;
- server_name {{ subdomain }}.{{ hostname }};
+ server_name {{ hgweb_subdomain }}.{{ hostname }};
- access_log /var/log/nginx/{{ subdomain }}.{{ hostname }}.access.log;
- error_log /var/log/nginx/{{ subdomain }}.{{ hostname }}.error.log;
+ access_log /var/log/nginx/{{ hgweb_subdomain }}.{{ hostname }}.access.log;
+ error_log /var/log/nginx/{{ hgweb_subdomain }}.{{ hostname }}.error.log;
- root /home/{{ user }}/hg/mercurial/templates/;
+ root /home/{{ hgweb_user }}/hg/mercurial/templates/;
--- a/roles/hgweb/templates/etc/supervisor/conf.d/hgweb.conf Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/templates/etc/supervisor/conf.d/hgweb.conf Mon Jun 27 16:30:20 2016 +0800
-command = /home/{{ user }}/hgwebfiles/venv/bin/gunicorn --config=/home/{{ user }}/hgwebfiles/gunicorn.conf hgweb:application
-directory = /home/{{ user }}/hgwebfiles/
+command = /home/{{ hgweb_user }}/hgwebfiles/venv/bin/gunicorn --config=/home/{{ hgweb_user }}/hgwebfiles/gunicorn.conf hgweb:application
+directory = /home/{{ hgweb_user }}/hgwebfiles/
--- a/roles/hgweb/templates/gunicorn.conf Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/templates/gunicorn.conf Mon Jun 27 16:30:20 2016 +0800
-bind = 'unix:/home/{{ user }}/hgwebfiles/socket'
+bind = 'unix:/home/{{ hgweb_user }}/hgwebfiles/socket'
+workers = {{ hgweb_workers }}
worker_class = 'eventlet'
--- a/roles/hgweb/templates/hgweb.conf Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/templates/hgweb.conf Mon Jun 27 16:30:20 2016 +0800
-/ = /home/{{ user }}/repos/*
+/ = /home/{{ hgweb_user }}/repos/*
-simple4server = /home/{{ user }}/evolve/hgext/simple4server.py
+simple4server = /home/{{ hgweb_user }}/evolve/hgext/simple4server.py
-baseurl = http://{{ subdomain }}.{{ hostname }}/
-logourl = http://{{ subdomain }}.{{ hostname }}/
+baseurl = http://{{ hgweb_subdomain }}.{{ hostname }}/
+logourl = http://{{ hgweb_subdomain }}.{{ hostname }}/
+contact = {{ hgweb_contact }}
highlightfiles = size('<100k')
--- a/roles/hgweb/templates/hgweb.py Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/templates/hgweb.py Mon Jun 27 16:30:20 2016 +0800
# Path to repo or hgweb config to serve (see 'hg help hgweb')
-config = "/home/{{ user }}/hgwebfiles/hgweb.conf"
+config = "/home/{{ hgweb_user }}/hgwebfiles/hgweb.conf"
# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
-import sys; sys.path.insert(0, "/home/{{ user }}/hg/")
+import sys; sys.path.insert(0, "/home/{{ hgweb_user }}/hg/")
# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()
--- a/roles/hgweb/vars/main.yml Sun Jun 26 17:43:00 2016 +0000
+++ b/roles/hgweb/vars/main.yml Mon Jun 27 16:30:20 2016 +0800
-contact: 'Me Myself <me@mydomain>'
-mercurial_url: https://selenic.com/hg
-evolve_url: https://www.mercurial-scm.org/repo/evolve
+hgweb_contact: 'Me Myself <me@mydomain>'
+hgweb_mercurial_url: https://selenic.com/hg
+hgweb_mercurial_rev: stable
+hgweb_evolve_url: https://www.mercurial-scm.org/repo/evolve
+hgweb_evolve_rev: stable