-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yaml
107 lines (92 loc) · 2.92 KB
/
playbook.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
- hosts: all
vars:
app_name: hockeypuck
host_dir: "{{ app_path }}/{{ app_name }}"
base_dir: "{{ host_dir }}/{{ deployment }}"
log_dir: "{{ base_dir }}/log"
conf_dir: "{{ base_dir }}/etc"
tasks:
- name: Install prereqs to install from PPA source repos
apt: pkg={{ item }} state=latest update_cache=yes
with_items:
- python-pycurl
- apt-transport-https
- software-properties-common
tags:
- install
- name: Add installation source repo
apt_repository: repo={{ source_repo }} state=present
tags:
- install
- upgrade-charm
- name: Install required packages
apt: pkg=hockeypuck state=latest update_cache=yes
tags:
- install
- upgrade-charm
- name: Create directories
file: path={{ item.path }} state=directory recurse=yes owner=hockeypuck mode={{ item.mode }}
with_items:
- path: "{{ host_dir }}"
mode: "0700"
- path: "{{ conf_dir }}"
mode: "0700"
- path: "{{ log_dir }}"
mode: "0755"
tags:
- install
- config-changed
- upgrade-charm
- name: Configure upstart job
template: src=templates/upstart.j2 dest=/etc/init/hockeypuck.conf
tags:
- config-changed
- name: Website relation
shell: relation-set -r {{ item.__relid__ }} host={{ unit_private_address }} port={{ hkp_port }}
tags:
- website-relation-changed
- config-changed
with_items: relations.website
- name: Keymaster relations
shell: >
relation-set -r {{ item.__relid__ }}
recon_addr={{ unit_private_address }}:{{ recon_port }}
http_addr={{ unit_private_address }}:{{ hkp_port }}
tags:
- keymaster-relation-changed
with_items: relations.keymaster
- name: Gatekeeper relations
shell: >
relation-set -r {{ item.__relid__ }}
recon_addr={{ unit_private_address }}:{{ recon_port }}
http_addr={{ unit_private_address }}:{{ hkp_port }}
tags:
- gatekeeper-relation-changed
with_items: relations.gatekeeper
- name: Configure Hockeypuck
template: src=templates/hockeypuck.conf.j2 dest={{ conf_dir }}/hockeypuck.conf
tags:
- config-changed
- mongodb-relation-changed
- keymaster-relation-changed
- gatekeeper-relation-changed
- name: Restart service
service: name=hockeypuck state=restarted
tags:
- start
- config-changed
- upgrade-charm
- mongodb-relation-changed
- keymaster-relation-changed
- gatekeeper-relation-changed
- name: Expose service
shell: open-port {{ item }}
with_items:
- "{{ hkp_port }}"
- "{{ recon_port }}"
tags:
- start
- name: Stop service
service: name=hockeypuck state=stopped
tags:
- stop