-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.yaml
71 lines (64 loc) · 2.16 KB
/
main.yaml
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
- name: check if required variables are defined
ansible.builtin.assert:
that:
- "{{ item }} is defined"
fail_msg: "{{ item }} variable is required"
loop:
- ydb_domain
- ydb_pool_kind
- ydb_cores_dynamic
- ydb_brokers
- ydb_dbname
- ydb_dynnodes
- name: create dynamic node configuration file
command: "{{ ydb_dir }}/home/update_config_file.sh ydbd-config.yaml ydbd-config-dynamic.yaml COMPUTE {{ ydb_cores_dynamic }}"
changed_when: false
- name: create dynamic node systemd unit
template:
src: ydbd-dynnode.service
dest: "/etc/systemd/system/ydbd-{{ ydb_dbname }}-{{ item.instance }}.service"
loop: "{{ ydb_dynnodes }}"
notify:
- daemon reload
- name: flush handlers
meta: flush_handlers
- name: start dynamic nodes
ansible.builtin.systemd:
name: "ydbd-{{ ydb_dbname }}-{{ item.instance }}.service"
state: started
enabled: true
loop: "{{ ydb_dynnodes }}"
- name: get ydb token
ydb_platform.ydb.get_token:
ydb_bin: "{{ ydb_dir }}/bin/ydb"
ld_library_path: "{{ ydb_dir }}/lib"
ca_file: "{{ ydb_dir }}/certs/ca.crt"
endpoint: "grpcs://{{ inventory_hostname }}:2135"
database: "/{{ ydb_domain }}"
user: "{{ ydb_user }}"
password: "{{ ydb_password }}"
run_once: true
register: ydb_credentials
until: "'token' in ydb_credentials"
retries: 10
delay: 10
- name: create YDB database
ydb_platform.ydb.create_database:
ydbd_bin: "{{ ydb_dir }}/bin/ydbd"
ld_library_path: "{{ ydb_dir }}/lib"
ca_file: "{{ ydb_dir }}/certs/ca.crt"
endpoint: "grpcs://{{ inventory_hostname }}:2135"
database: "/{{ ydb_domain }}/{{ ydb_dbname }}"
token: "{{ ydb_credentials.token }}"
pool_kind: "{{ ydb_pool_kind }}"
groups: "{{ ydb_database_groups }}"
run_once: true
- name: wait for ydb discovery to start working locally
ydb_platform.ydb.wait_discovery:
ydb_bin: "{{ ydb_dir }}/bin/ydb"
ld_library_path: "{{ ydb_dir }}/lib"
ca_file: "{{ ydb_dir }}/certs/ca.crt"
endpoint: "grpcs://{{ inventory_hostname }}:{{ 2136 + item.offset }}"
database: "/{{ ydb_domain }}/{{ ydb_dbname }}"
token: "{{ ydb_credentials.token }}"
loop: "{{ ydb_dynnodes }}"