blob: e4f94f5409f875ac33ff25a4b9bae28afb8e4788 (
plain)
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
|
---
- hosts: localhost
vars_files:
- "/etc/distbuild/distbuild.conf"
tasks:
- set_fact: ARTIFACT_CACHE_SERVER={{ TROVE_HOST }}
when: ARTIFACT_CACHE_SERVER is not defined
- name: Create mountpoint for extra disk space /srv/distbuild/
file: path=/srv/distbuild state=directory owner=root group=root mode=0755
- name: Create the morph and morph-cache-server configuration files
template: src=/usr/share/distbuild-setup/{{ item }} dest=/etc/{{ item }}
with_items:
- morph.conf
- morph-cache-server.conf
- name: Link the morph log file
file: src=/srv/distbuild/morph.log dest=/var/log/morph.log state=link force=yes
- name: Create the controller configuration files
template: src=/usr/share/distbuild-setup/{{ item }} dest=/etc/{{ item }}
with_items:
- morph-controller.conf
- morph-controller-helper.conf
when: DISTBUILD_CONTROLLER
- name: Link the controller log files
file: src=/srv/distbuild/{{ item }} dest=/var/log/{{ item }} state=link force=yes
with_items:
- morph-controller.log
- morph-controller-helper.log
when: DISTBUILD_CONTROLLER
- name: Create the worker configuration files
template: src=/usr/share/distbuild-setup/{{ item }} dest=/etc/{{ item }}
with_items:
- morph-worker.conf
- morph-worker-helper.conf
when: DISTBUILD_WORKER
- name: Link the controller log files
file: src=/srv/distbuild/{{ item }} dest=/var/log/{{ item }} state=link force=yes
with_items:
- morph-worker.log
- morph-worker-helper.log
when: DISTBUILD_WORKER
- name: Create /root/.ssh directory
file: path=/root/.ssh state=directory owner=root group=root mode=0700
- name: Copy the worker ssh key
copy: src={{ WORKER_SSH_KEY }} dest=/root/.ssh/id_rsa owner=root group=root mode=0600
- name: Create ssh public key
shell: ssh-keygen -y -f /root/.ssh/id_rsa > /root/.ssh/id_rsa.pub creates=/root/.ssh/id_rsa.pub
- name: Add trove's host key
shell: |
trove_key="$(ssh-keyscan -t dsa,ecdsa,rsa {{ TROVE_HOST|quote }})"
if [ -n "$trove_key" ]; then
echo "$trove_key" > /etc/ssh/ssh_known_hosts
fi
creates=/etc/ssh/ssh_known_hosts
- name: Enable the morph-cache-server service
service: name=morph-cache-server.service enabled=yes
register: morph_cache_server_service
- name: Restart the morph-cache-server service
service: name=morph-cache-server state=restarted
when: morph_cache_server_service|changed
- name: Enable the morph-worker service
service: name=morph-worker.service enabled=yes
register: morph_worker_service
when: DISTBUILD_WORKER
- name: Restart the morph-worker service
service: name=morph-worker state=restarted
when: morph_worker_service|changed
- name: Enable the morph-worker-helper service
service: name=morph-worker-helper.service enabled=yes
register: morph_worker_helper_service
when: DISTBUILD_WORKER
- name: Restart the morph-worker-helper service
service: name=morph-worker-helper state=restarted
when: morph_worker_helper_service|changed
- name: Enable the morph-controller service
service: name=morph-controller.service enabled=yes
register: morph_controller_service
when: DISTBUILD_CONTROLLER
- name: Restart the morph-controller service
service: name=morph-controller state=restarted
when: morph_controller_service|changed
- name: Enable the morph-controller-helper service
service: name=morph-controller-helper.service enabled=yes
register: morph_controller_helper_service
when: DISTBUILD_CONTROLLER
- name: Restart the morph-controller-helper service
service: name=morph-controller-helper state=restarted
when: morph_controller_helper_service|changed
|