File tree 6 files changed +56
-11
lines changed
6 files changed +56
-11
lines changed Original file line number Diff line number Diff line change 13
13
- uses : actions/checkout@v4
14
14
15
15
- name : install dependencies
16
- run : >
17
- pip install -r .dev_requirements.txt
16
+ run : pip install -r .dev_requirements.txt
17
+
18
+ - name : install Ansbile dependencies
19
+ run : ansible-galaxy install -r requirements.yml
18
20
19
21
- run : yamllint --strict -c .yamllint .
20
22
Original file line number Diff line number Diff line change 15
15
- name : install dependencies
16
16
run : pip install -r .dev_requirements.txt
17
17
18
+ - name : install Ansbile dependencies
19
+ run : ansible-galaxy install -r requirements.yml
20
+
18
21
- name : test playbook
19
22
run : molecule test
20
23
env :
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ platforms:
26
26
volumes :
27
27
- /sys/fs/cgroup:/sys/fs/cgroup:ro
28
28
published_ports :
29
- - 3306/tcp
29
+ - 3306/tcp
30
30
- name : opencast_mariadb_ubuntu
31
31
image : docker.io/ubuntu:latest
32
32
pre_build_image : false
Original file line number Diff line number Diff line change 1
1
---
2
2
- name : Verify
3
3
hosts : all
4
- gather_facts : false
4
+ vars :
5
+ database_password : " 1234"
5
6
tasks :
6
- - name : Check if MariaDB is active
7
- ansible.builtin.command :
8
- cmd : systemctl is-active mariadb
9
- changed_when : false
7
+ - name : Check MariaDB socket exists
8
+ ansible.builtin.wait_for :
9
+ path : " {{ '/run/mysqld/mysqld.sock' if ansible_os_family == 'Debian' else '/var/lib/mysql/mysql.sock' }}"
10
+ delay : 1
11
+ timeout : 10
12
+
13
+ - name : Check MariaDB port listening
14
+ ansible.builtin.wait_for :
15
+ port : 3306
16
+ timeout : 10
17
+
18
+ - name : Check current user
19
+ community.mysql.mysql_query :
20
+ login_host : localhost
21
+ login_user : opencast
22
+ login_password : " {{ database_password }}"
23
+ query : >-
24
+ SELECT CURRENT_USER() as USER;
25
+ register : query_current_user
26
+
27
+ - name : Fail on invalid user
28
+ ansible.builtin.fail :
29
+ msg : User should be "opencast@%" but is {{ query_current_user.query_result.0.0.USER }}
30
+ when : " 'opencast@%' != query_current_user.query_result.0.0.USER"
31
+
32
+ - name : Check Opencast table exists
33
+ community.mysql.mysql_query :
34
+ login_host : localhost
35
+ login_user : opencast
36
+ login_password : " {{ database_password }}"
37
+ query : >-
38
+ SHOW DATABASES LIKE "opencast";
39
+ register : query_databases
40
+
41
+ - name : Fail on not existing opencast database
42
+ ansible.builtin.fail :
43
+ msg : Opencast database does not exist
44
+ when : " query_databases.rowcount.0 != 1"
Original file line number Diff line number Diff line change
1
+ ---
2
+ collections :
3
+ - community.general
4
+ - community.mysql
Original file line number Diff line number Diff line change 38
38
39
39
- name : Configure mariadb
40
40
notify : Restart MariaDB
41
- ansible.builtin .ini_file :
41
+ community.general .ini_file :
42
42
dest : " {{ '/etc/mysql/mariadb.conf.d/50-server.cnf' if ansible_os_family == 'Debian' else '/etc/my.cnf.d/opencast.cnf' }}"
43
43
section : mysqld
44
44
option : " {{ item.key }}"
63
63
state : started
64
64
enabled : true
65
65
66
- - name : Start MariaDB
66
+ - name : Wait for MariaDB start
67
67
ansible.builtin.wait_for :
68
- path : / var/lib/mysql/mysql.sock
68
+ path : " {{ '/run/mysqld/mysqld.sock' if ansible_os_family == 'Debian' else '/ var/lib/mysql/mysql.sock' }} "
69
69
delay : 1
70
+ timeout : 30
70
71
71
72
- name : Set MariaDB root user password (RedHat)
72
73
when : ansible_os_family == 'RedHat'
You can’t perform that action at this time.
0 commit comments