--- a/playbook-example.yml Mon Jun 27 16:30:20 2016 +0800
+++ b/playbook-example.yml Mon Jun 27 16:49:16 2016 +0800
# need to use the virtual host name (i.e. http://127.0.0.1/ won't work).
# Make sure you have DNS records for hg.mydomain or add it to /etc/hosts.
- hostname: name={{ hostname }}
- name: Update /etc/hosts
- lineinfile: dest=/etc/hosts line="127.0.0.1 {{ hostname }} hg.{{ hostname }}"
+ line: '127.0.0.1 {{ hostname }} hg.{{ hostname }}'
# NOTE: this role depends on nginx and supervisor packages being installed,
# and also it uses two handlers:
# This role doesn't have the handlers, so this playbook restarts the
# services in post_tasks instead.
- apt: package=nginx-full state=installed update_cache=yes cache_valid_time=3600
- name: Disable default Nginx site
- file: path=/etc/nginx/sites-enabled/default state=absent
+ path: /etc/nginx/sites-enabled/default
- name: Install Supervisor
- apt: package=supervisor state=installed
- service: name=nginx state=restarted
- name: Restart Supervisor
- service: name=supervisor state=restarted sleep=1
--- a/roles/hgweb/handlers/main.yml Mon Jun 27 16:30:20 2016 +0800
+++ b/roles/hgweb/handlers/main.yml Mon Jun 27 16:49:16 2016 +0800
become_user: '{{ hgweb_user }}'
- supervisorctl: name=hgweb state=restarted
--- a/roles/hgweb/tasks/appinstall.yml Mon Jun 27 16:30:20 2016 +0800
+++ b/roles/hgweb/tasks/appinstall.yml Mon Jun 27 16:49:16 2016 +0800
- name: Ensure required directories exist
- file: path=/home/{{ hgweb_user }}/{{ item }}/ state=directory
+ path: /home/{{ hgweb_user }}/{{ item }}/
- copy: src=.hgrc dest=/home/{{ hgweb_user }}/.hgrc
+ dest: /home/{{ hgweb_user }}/.hgrc
- name: Pull Mercurial {{ hgweb_mercurial_rev }}
- hg: repo={{ hgweb_mercurial_url }} dest=/home/{{ hgweb_user }}/hg/ revision={{ hgweb_mercurial_rev }}
+ repo: '{{ hgweb_mercurial_url }}'
+ dest: /home/{{ hgweb_user }}/hg/
+ revision: '{{ hgweb_mercurial_rev }}'
- name: Pull Evolve {{ hgweb_evolve_rev }}
- hg: repo={{ hgweb_evolve_url }} dest=/home/{{ hgweb_user }}/evolve/ revision={{ hgweb_evolve_rev }}
+ repo: '{{ hgweb_evolve_url }}'
+ dest: /home/{{ hgweb_user }}/evolve/
+ revision: '{{ hgweb_evolve_rev }}'
- template: src={{ item }} dest=/home/{{ hgweb_user }}/hgwebfiles/{{ item }}
+ dest: /home/{{ hgweb_user }}/hgwebfiles/{{ item }}
- name: Copy requirements.txt
- copy: src=requirements.txt dest=/home/{{ hgweb_user }}/hgwebfiles/requirements.txt
+ dest: /home/{{ hgweb_user }}/hgwebfiles/requirements.txt
- name: Set up venv for gunicorn
- pip: requirements=/home/{{ hgweb_user }}/hgwebfiles/requirements.txt state=latest virtualenv=/home/{{ hgweb_user }}/hgwebfiles/venv/
+ virtualenv: /home/{{ hgweb_user }}/hgwebfiles/venv/
+ requirements: /home/{{ hgweb_user }}/hgwebfiles/requirements.txt
--- a/roles/hgweb/tasks/main.yml Mon Jun 27 16:30:20 2016 +0800
+++ b/roles/hgweb/tasks/main.yml Mon Jun 27 16:49:16 2016 +0800
- user: name={{ hgweb_user }}
+ name: '{{ hgweb_user }}'
- apt: pkg={{ item }} state=present
- name: Install virtualenv
- apt: pkg=virtualenv state=present
when: ansible_distribution_release == 'jessie'
become_user: '{{ hgweb_user }}'
- name: Add supervisor app
- template: src=etc/supervisor/conf.d/hgweb.conf dest=/etc/supervisor/conf.d/hgweb.conf
+ src: etc/supervisor/conf.d/hgweb.conf
+ dest: /etc/supervisor/conf.d/hgweb.conf
- name: Add {{ hgweb_subdomain }}.{{ hostname }} Nginx site
- template: src=etc/nginx/sites-available/hgweb dest=/etc/nginx/sites-available/{{ hgweb_subdomain }}.{{ hostname }}
+ src: etc/nginx/sites-available/hgweb
+ dest: /etc/nginx/sites-available/{{ hgweb_subdomain }}.{{ hostname }}
- 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
+ src: /etc/nginx/sites-available/{{ hgweb_subdomain }}.{{ hostname }}
+ dest: /etc/nginx/sites-enabled/50{{ hgweb_subdomain }}.{{ hostname }}