-
Notifications
You must be signed in to change notification settings - Fork 2
/
p2.yml
84 lines (79 loc) · 1.84 KB
/
p2.yml
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
---
# Java installation
- name: "OpenJDK: Add package repo key"
apt_key:
url: https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
- name: "OpenJDK: Add package repo"
apt_repository:
repo: "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ buster main"
filename: adoptopenjdk
- name: "OpenJDK: Install package"
apt:
name: adoptopenjdk-8-hotspot
- name: "Fetch p2"
git:
repo: https://github.com/iNPUTmice/p2.git
dest: /src/p2
force: yes
refspec: '+refs/heads/master'
version: 909be3428864f8e80b4a27ff9aa9dac7e89a86e2
- name: "Install Maven"
apt:
name: maven
# Build
- name: "Build p2"
command: mvn package
args:
chdir: /src/p2
environment:
JAVA_HOME: /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64
PATH: "/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin:{{ ansible_env.PATH }}"
# Install
- name: "Create p2 app directory"
file:
path: /opt/p2
state: directory
- name: "Install p2 jar"
copy:
src: /src/p2/target/p2-0.3.jar
dest: /opt/p2/p2.jar
remote_src: yes
- name: "Create p2 config directory"
file:
path: /etc/p2
state: directory
- name: "Create p2 user"
user:
name: p2
home: /var/lib/p2
system: yes
- name: "Create p2 data directory"
file:
path: /var/lib/p2
state: directory
owner: p2
mode: 0750
# Configure
- name: "Deploy p2 config file"
template:
src: templates/p2.conf
dest: /etc/p2/p2.conf
- name: "Deploy service file"
copy:
src: files/p2.service
dest: /etc/systemd/system/p2.service
- name: "Add component configuration to Prosody"
template:
src: templates/p2.cfg.lua
dest: /etc/prosody/conf.d/p2.cfg.lua
owner: prosody
mode: 0750
notify:
- import certs
- restart prosody
- name: "Enable and start service"
systemd:
name: p2
enabled: yes
state: started
daemon_reload: yes