-
Notifications
You must be signed in to change notification settings - Fork 386
/
site.yml
170 lines (142 loc) · 4.03 KB
/
site.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
---
# Install Dkron beta on a clean instance
- hosts: localhost
vars:
project_id: 904af849-79ff-4847-90f7-dfa02367ae72
tasks:
- equinix.cloud.metal_device:
hostname: "{{ item }}"
operating_system: ubuntu_22_04
plan: c3.small.x86
metro: am
project_id: "{{ project_id }}"
tags:
- server
loop:
- dkron01
- dkron02
- dkron03
# - equinix.cloud.metal_device:
# hostname: dkron04
# operating_system: ubuntu_22_04
# plan: c3.small.x86
# metro: am
# project_id: "{{ project_id }}"
# tags:
# - agent
- hosts: all
user: root
become: true
become_method: sudo
vars:
version: 4.0.0
datadog_api_key: "{{ lookup('ansible.builtin.env', 'DKRON_DD_API_KEY') }}"
datadog_checks:
openmetrics:
init_config:
instances:
- openmetrics_endpoint: http://localhost:8080/metrics/
namespace: "dkron"
metrics:
- dkron.*
roles:
- role: datadog.datadog
become: true
tags: datadog
tasks:
- name: Copy package
copy:
src: ../../dist/dkron_{{ version }}_linux_amd64.deb
dest: /tmp
- name: Install package
apt:
deb: /tmp/dkron_{{ version }}_linux_amd64.deb
- name: ensure data dir
file:
path: /var/lib/dkron
owner: root
group: root
mode: 755
state: directory
### File descriptor and memory tweaks
- name: Increase sysctl open files system wide
sysctl:
name: fs.file-max
value: "3243542"
tags: performance
- name: Increasing number of open files
lineinfile: dest=/etc/systemd/system.conf regexp='^DefaultLimitNOFILE=65535' line='DefaultLimitNOFILE=65535' state=present
tags: performance
- name: Increasing number of open files in service
lineinfile: dest=/lib/systemd/system/dkron.service regexp='^KillSignal=SIGTERM\n^LimitNOFILE=65535' line='LimitNOFILE=65535' state=present
tags: performance_b
### Network performance tweaks
- name: Set ARP GC entry point at 0
sysctl:
name: net.ipv4.neigh.default.gc_thresh1
value: "0"
tags: performance
- name: Increase maximum number of sockets
sysctl:
name: net.core.somaxconn
value: "32768"
tags: performance
- name: Increase maximum number of sockets in the backlog
sysctl:
name: net.ipv4.tcp_max_syn_backlog
value: "131072"
tags: performance
- name: Setting sane defaults for TCP reading sockets
sysctl:
name: net.ipv4.tcp_rmem
value: "4096 16384 16777216"
tags: performance
- name: Setting sane defaults for TCP writing sockets
sysctl:
name: net.ipv4.tcp_wmem
value: "4096 16384 16777216"
tags: performance
- hosts: tag_server
user: root
become: true
become_method: sudo
vars:
dkron_log_level: debug
dkron_bootstrap_expect: 3
dkron_data_dir: /var/lib/dkron
dkron_server: "true"
tasks:
- set_fact:
dkron_servers: "{{ groups['tag_server'] | map('extract', hostvars, ['ansible_all_ipv4_addresses', 1]) | list }}"
tags: config
- name: configure
template: src={{ item }}.yml.j2 dest=/etc/dkron/{{ item }}.yml
loop:
- dkron
tags: config
- name: ensure service is running and enabled
systemd:
name: dkron
enabled: yes
state: restarted
- hosts: tag_agent
user: root
become: true
become_method: sudo
vars:
dkron_log_level: debug
dkron_data_dir: /var/lib/dkron
dkron_server: "false"
dkron_servers: "{{ hostvars['dkron01']['dkron_servers'] }}"
dkron_bootstrap_expect: 3
tasks:
- name: configure
template: src={{ item }}.yml.j2 dest=/etc/dkron/{{ item }}.yml
loop:
- dkron
tags: config
- name: ensure service is running and enabled
systemd:
name: dkron
enabled: yes
state: restarted