-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision_optuna_db.ansible.yml
64 lines (56 loc) · 1.31 KB
/
provision_optuna_db.ansible.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
- name: provision cluster
hosts: all
tasks:
- name: update packages
ansible.builtin.apt:
upgrade: yes
update_cache: yes
become: true
- name: install packages
ansible.builtin.apt:
pkg:
- screen
- htop
- python3-pip
- build-essential
- libmysqlclient-dev
- pkg-config
- mysql-server
become: true
- name: configure mysqld listener
ansible.builtin.lineinfile:
path: /etc/mysql/mysql.conf.d/mysqld.cnf
regexp: '^bind-address'
line: bind-address = 0.0.0.0
state: present
register: my_cnf
become: yes
- name: restart mysqld
ansible.builtin.service:
name: mysql
state: restarted
when: my_cnf.changed
become: yes
- name: configure htop
ansible.builtin.copy:
src: htoprc
dest: ~/.config/htop/
- name: install helper python modules
ansible.builtin.pip:
name:
- mysqlclient
extra_args: --user
become: yes
- name: create optuna db
ansible.builtin.mysql_db:
name: "optuna"
state: "present"
become: yes
- name: create optuna db user
ansible.builtin.mysql_user:
name: "optuna"
host: "%"
password: "{{ lookup('env', 'OPTUNA_DB_PASS') }}"
priv: 'optuna.*:ALL'
state: "present"
become: yes