-
Notifications
You must be signed in to change notification settings - Fork 29
/
web_nix.yml
109 lines (98 loc) · 3.38 KB
/
web_nix.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
- name: web | Concourse web start script config
template:
src="concourse-web.j2"
dest="{{ concourseci_bin_dir }}/concourse-web"
mode=0755
notify:
- restart concourse-web
- name: web | Copy session public key
copy:
content="{{ concourseci_key_session_public }}"
dest="{{ concourse_web_options_combined['CONCOURSE_SESSION_SIGNING_KEY'] }}.pub"
mode="0644"
owner="{{ concourseci_user }}"
group="{{ concourseci_group }}"
notify:
- restart concourse-web
- name: web | Copy session private key
copy:
content="{{ concourseci_key_session_private }}"
dest="{{ concourse_web_options_combined['CONCOURSE_SESSION_SIGNING_KEY'] }}"
mode="0600"
owner="{{ concourseci_user }}"
group="{{ concourseci_group }}"
no_log: True
notify:
- restart concourse-web
- name: web | Copy tsa private key
copy:
content="{{ concourseci_key_tsa_private }}"
dest="{{ concourse_web_options_combined['CONCOURSE_TSA_HOST_KEY'] }}"
mode="0600"
owner="{{ concourseci_user }}"
group="{{ concourseci_group }}"
no_log: True
notify:
- restart concourse-web
- name: web | Create authorized key for tsa
authorized_key:
user: "{{ concourseci_user }}"
key: "{{ item.public }}"
path: "{{ concourse_web_options_combined['CONCOURSE_TSA_AUTHORIZED_KEYS'] }}"
manage_dir: no
with_items: "{{ concourseci_worker_keys }}"
notify:
- restart concourse-web
- name: web | Write RBAC_CONFIG
copy:
content: "{{ concourse_rbac | to_yaml }}"
dest: "{{ concourse_web_options_combined['CONCOURSE_CONFIG_RBAC'] }}"
mode: 0755
owner: "{{ concourseci_user }}"
group: "{{ concourseci_group }}"
when: "concourse_web_options_combined['CONCOURSE_CONFIG_RBAC'] is defined"
notify:
- restart concourse-web
- name: web | Templating concourse web start init script (linux)
template:
src="concourse-web-init.sh.j2"
dest="/etc/init.d/concourse-web"
mode=0755
notify:
- reload systemd
- restart concourse-web
when: "ansible_system == 'Linux'"
- name: web | Ensure Concourse web is running and Starts on boot (linux)
service:
name="concourse-web"
state="started"
enabled=True
ignore_errors: "{{ concourse_ignore_errors }}"
when: "ansible_system == 'Linux'"
- name: web | Templating concourse web start launchd plist (macOSx)
template:
src="{{ concourseci_launchd_web }}.plist.j2"
dest="{{ concourseci_launchd_path }}/{{ concourseci_launchd_web }}.plist"
mode=0750
owner="root"
group="wheel"
validate='plutil %s'
notify:
- restart concourse-web
register: launchd_template
when: "ansible_system == 'Darwin'"
- name: web | Ensure Concourse web is running and Starts on boot (macOSx)
shell: launchctl load -w {{ concourseci_launchd_path }}/{{ concourseci_launchd_web }}.plist && launchctl start {{ concourseci_launchd_web }}
changed_when: False # since no way to detect if it started or not
when: "ansible_system == 'Darwin'"
- name: web | Create base resource type defaults configuration file
copy:
owner: "{{ concourseci_user }}"
group: "{{ concourseci_group }}"
dest: "{{ concourse_web_options_combined['CONCOURSE_BASE_RESOURCE_TYPE_DEFAULTS'] }}"
content: "{{ concourseci_web_resource_type_defaults | to_nice_yaml(indent=2) }}"
mode: '644'
when: "{{ concourseci_web_resource_type_defaults | dict2items | length > 0 }}"
notify:
- restart concourse-web