-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
74 lines (62 loc) · 3.1 KB
/
playbook.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
---
- hosts: clowderserver
become: yes
vars:
clowder_version: 0.9.x-SNAPSHOT
clowder_dist: ../../BrownDog/clowder/target/universal/clowder-{{ clowder_version }}.zip
clowder_interface: ens4
pre_tasks:
- apt_repository: repo='deb http://www.rabbitmq.com/debian/ testing main' state=present
- apt_key: url=http://www.rabbitmq.com/rabbitmq-signing-key-public.asc state=present
# - apt_repository: repo='deb http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main' state=present
# - apt_key: url=http://packages.elasticsearch.org/GPG-KEY-elasticsearch state=present
# - apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' state=present
# - apt_key: keyserver=keyserver.ubuntu.com id=7F0CEB10 state=present
# This package should usually be supplied in the base image, vivid requires a reboot after it is installed.
# - apt: pkg=policykit-1 state=installed
- name: Install Packages
apt: pkg={{ item }} state=installed update_cache=yes allow_unauthenticated=yes
with_items:
- openjdk-8-jdk
- mongodb
- rabbitmq-server
- unzip
- postfix
- git
- nginx
- name: Configure nginx
copy: src=files/clowder-nginx.conf dest=/etc/nginx/conf.d/clowder-nginx.conf
- name: Enable services
service: name={{ item }} enabled=yes state=restarted
with_items:
- mongodb
- nginx
- command: rabbitmq-plugins enable rabbitmq_management
- command: rabbitmqctl -q add_user {{ rabbitmq_username }} {{ rabbitmq_password }}
ignore_errors: yes
- name: Ensure clowder group exists
group: name=clowder state=present system=yes
- name: Ensure clowder user exists
user: name=clowder group=clowder createhome=no shell=/bin/false system=yes state=present
- name: Copy clowder.zip distribution to /opt
copy: src={{ clowder_dist }} dest=/opt/clowder.zip
- unarchive: src=/opt/clowder.zip dest=/opt copy=no
- file: path=/opt/clowder-{{ clowder_version }} state=directory recurse=yes owner=clowder group=users
- file: path=/opt/clowder-{{ clowder_version }}/custom state=directory owner=clowder group=users
- file: path=/opt/clowder src=/opt/clowder-{{ clowder_version }} state=link
- name: Configuring Clowder application
template: src=templates/custom.conf.j2 dest=/opt/clowder/custom/custom.conf
- lineinfile: dest=/opt/clowder/custom/play.plugins create=yes line="9992:services.RabbitmqPlugin"
- lineinfile: dest=/opt/clowder/custom/play.plugins create=yes line="10700:services.ElasticsearchPlugin"
- lineinfile: dest=/opt/clowder/custom/play.plugins create=yes line="10501:services.PolyglotPlugin"
- name: Setup Clowder systemd daemon service
template: src=templates/clowder.service.j2 dest=/etc/systemd/system/clowder.service
- command: systemctl daemon-reload
- name: Enable services
service: name=clowder state=restarted enabled=yes
handlers:
- name: restart services
service: name={{ item }} state=restarted
with_items:
- mongodb
- rabbitmq-server