Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenSUSE support #605

Merged
merged 25 commits into from Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mysql_hardening.yml
Expand Up @@ -37,7 +37,7 @@ jobs:
- debian11
# - amazon # geerlingguy.mysql does not support fedora
# - arch # needs to be fixed
# - opensuse_tumbleweed # needs to be fixed
- opensuse_tumbleweed # needs to be fixed
# - fedora # geerlingguy.mysql does not support fedora
steps:
- name: Checkout repo
Expand Down
7 changes: 7 additions & 0 deletions molecule/mysql_hardening/converge.yml
Expand Up @@ -24,6 +24,13 @@
- mysql_python_package_debian is not defined
- ansible_distribution != "Ubuntu"
- ansible_distribution_major_version|int < 20

- name: Use Python 3 on Suse
set_fact:
ansible_python_interpreter: /usr/bin/python3
when:
- ansible_os_family == 'Suse'

- include_role:
name: mysql_hardening
vars:
Expand Down
15 changes: 9 additions & 6 deletions molecule/mysql_hardening/prepare.yml
Expand Up @@ -15,6 +15,12 @@
- ansible_distribution == 'Debian'
- ansible_distribution_major_version|int >= 11

- name: Use Python 3 on Suse
set_fact:
ansible_python_interpreter: /usr/bin/python3
when:
- ansible_os_family == 'Suse'

- name: Use Python 2 on Debian 10
set_fact:
ansible_python_interpreter: /usr/bin/python
Expand All @@ -29,11 +35,9 @@
update_cache: true
when: ansible_os_family == 'Debian'

- name: install required tools on SuSE
community.general.zypper:
name: "python-xml"
state: present
when: ansible_facts.os_family == 'Suse'
- name: Install required python packages on Suse
ansible.builtin.shell: zypper -n install python-xml python3-rpm python3-PyMySQL
when: ansible_os_family == 'Suse'

- name: create missing directory
file:
Expand All @@ -56,7 +60,6 @@
- ansible_distribution != "Ubuntu"
- ansible_distribution_major_version|int < 20


- include_role:
name: dev-sec.mysql

Expand Down
1 change: 1 addition & 0 deletions roles/mysql_hardening/README.md
Expand Up @@ -16,6 +16,7 @@ It configures:

- Ansible 2.9.0
- An existing MySQL installation
- python-jmespath on the ansible host

### Example playbook

Expand Down
10 changes: 10 additions & 0 deletions roles/mysql_hardening/vars/Suse.yml
@@ -0,0 +1,10 @@
---
mysql_daemon: mariadb
mysql_hardening_mysql_conf_file: '/etc/my.cnf'
mysql_hardening_mysql_confd_dir: '/etc/my.cnf.d'

mysql_cnf_owner: 'root' # owner of /etc/my.cnf.d/*.cnf files
mysql_cnf_group: 'mysql' # owner of /etc/my.cnf.d/*.cnf files

mysql_hardening_group: 'mysql'
login_unix_socket: '/run/mysql/mysql.sock'