20:92a12df47b17
Anton Shestakov <av6@dwimlabs.net>, Tue, 09 Aug 2016 16:00:33 +0800
playbook: rephrase the first note a bit

next change 21:40558d07f6d0
previous change 18:464f9dec4e2f

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: this role depends on nginx and supervisor packages being installed,
# and also it uses two handlers:
# - reload supervisor
# - restart nginx
# This role doesn't have the handlers, so this playbook restarts the
# services in post_tasks instead.
- 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]
post_tasks:
- name: Restart Nginx
service:
name: nginx
state: restarted
- name: Restart Supervisor
service:
name: supervisor
state: restarted
sleep: 1
...