Skip to content

Commit e66c2eb

Browse files
rndmh3roFlorian Goth
andauthored
Add OpenSUSE support (#605)
* Add variables for mariadb on opensuse Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * enable pipeline Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * add a note about the reuirement of the jmespath library. Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * Use python3 on opensuse Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * fix my yml. Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * use right ansible variable Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * Suse requires python-rpm Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * try zypper Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * python-xml Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * another try at fixing the install Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * fix my yml Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * another try Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * another try Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * another try now with rpm. Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * fix my yml... Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * typo Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * do the test for Suse on the shell and not in ansible Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * specify to use bash Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * specify to use bash * try the removes keyword of builtin.shell Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * fix ansible syntax Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * fix zypper syntax Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * ensure pymysql is present Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> * set ansible python interpreter in converge-step, too Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com> * move install task to prepare Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com> Signed-off-by: Florian Goth <fgoth@physik.uni-wuerzburg.de> Signed-off-by: Sebastian Gumprich <sebastian.gumprich@t-systems.com> Co-authored-by: Florian Goth <fgoth@physik.uni-wuerzburg.de>
1 parent 61e92aa commit e66c2eb

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

.github/workflows/mysql_hardening.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- debian11
3838
# - amazon # geerlingguy.mysql does not support fedora
3939
# - arch # needs to be fixed
40-
# - opensuse_tumbleweed # needs to be fixed
40+
- opensuse_tumbleweed # needs to be fixed
4141
# - fedora # geerlingguy.mysql does not support fedora
4242
steps:
4343
- name: Checkout repo

molecule/mysql_hardening/converge.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
- mysql_python_package_debian is not defined
2525
- ansible_distribution != "Ubuntu"
2626
- ansible_distribution_major_version|int < 20
27+
28+
- name: Use Python 3 on Suse
29+
set_fact:
30+
ansible_python_interpreter: /usr/bin/python3
31+
when:
32+
- ansible_os_family == 'Suse'
33+
2734
- include_role:
2835
name: mysql_hardening
2936
vars:

molecule/mysql_hardening/prepare.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
- ansible_distribution == 'Debian'
1616
- ansible_distribution_major_version|int >= 11
1717

18+
- name: Use Python 3 on Suse
19+
set_fact:
20+
ansible_python_interpreter: /usr/bin/python3
21+
when:
22+
- ansible_os_family == 'Suse'
23+
1824
- name: Use Python 2 on Debian 10
1925
set_fact:
2026
ansible_python_interpreter: /usr/bin/python
@@ -29,11 +35,9 @@
2935
update_cache: true
3036
when: ansible_os_family == 'Debian'
3137

32-
- name: install required tools on SuSE
33-
community.general.zypper:
34-
name: "python-xml"
35-
state: present
36-
when: ansible_facts.os_family == 'Suse'
38+
- name: Install required python packages on Suse
39+
ansible.builtin.shell: zypper -n install python-xml python3-rpm python3-PyMySQL
40+
when: ansible_os_family == 'Suse'
3741

3842
- name: create missing directory
3943
file:
@@ -56,7 +60,6 @@
5660
- ansible_distribution != "Ubuntu"
5761
- ansible_distribution_major_version|int < 20
5862

59-
6063
- include_role:
6164
name: dev-sec.mysql
6265

roles/mysql_hardening/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ It configures:
1616

1717
- Ansible 2.9.0
1818
- An existing MySQL installation
19+
- python-jmespath on the ansible host
1920

2021
### Example playbook
2122

roles/mysql_hardening/vars/Suse.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
mysql_daemon: mariadb
3+
mysql_hardening_mysql_conf_file: '/etc/my.cnf'
4+
mysql_hardening_mysql_confd_dir: '/etc/my.cnf.d'
5+
6+
mysql_cnf_owner: 'root' # owner of /etc/my.cnf.d/*.cnf files
7+
mysql_cnf_group: 'mysql' # owner of /etc/my.cnf.d/*.cnf files
8+
9+
mysql_hardening_group: 'mysql'
10+
login_unix_socket: '/run/mysql/mysql.sock'

0 commit comments

Comments
 (0)