* Update testing and remove old, unsupported OS versions Signed-off-by: Martin Schurz <[email protected]> * Update Arch OS Signed-off-by: Martin Schurz <[email protected]> * Fix SuSE login.defs issues Signed-off-by: Martin Schurz <[email protected]> * Debug ... Signed-off-by: Martin Schurz <[email protected]> * Fix SuSE stuff Signed-off-by: Martin Schurz <[email protected]> * Fix SuSE stuff Signed-off-by: Martin Schurz <[email protected]> * Update OS Support Signed-off-by: Martin Schurz <[email protected]> * Use Ansible mysql module Signed-off-by: Martin Schurz <[email protected]> * Update OS Support Signed-off-by: Martin Schurz <[email protected]> * Use existing Fedora images Signed-off-by: Martin Schurz <[email protected]> * Fix VM tests Signed-off-by: Martin Schurz <[email protected]> * fix last errors Signed-off-by: Martin Schurz <[email protected]> * Final fixes Signed-off-by: Martin Schurz <[email protected]> --------- Signed-off-by: Martin Schurz <[email protected]>
67 lines
2.4 KiB
YAML
67 lines
2.4 KiB
YAML
---
|
|
- name: Wrapper playbook for kitchen testing "ansible-mysql-hardening"
|
|
hosts: all
|
|
become: true
|
|
environment:
|
|
http_proxy: "{{ lookup('env', 'http_proxy') | default(omit) }}"
|
|
https_proxy: "{{ lookup('env', 'https_proxy') | default(omit) }}"
|
|
no_proxy: "{{ lookup('env', 'no_proxy') | default(omit) }}"
|
|
vars:
|
|
overwrite_global_mycnf: false
|
|
mysql_root_password: iloverandompasswordsbutthiswilldo
|
|
mysql_user_password: iloverandompasswordsbutthiswilldo
|
|
mysql_config_file: /etc/mysql/mariadb.cnf
|
|
mysql_root_password_update: true
|
|
tasks:
|
|
- name: Use Python 3 on Debian 11
|
|
ansible.builtin.set_fact:
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
when:
|
|
- ansible_facts.distribution == 'Debian'
|
|
- ansible_facts.distribution_major_version|int >= 11
|
|
|
|
- name: Use Python 3 on Suse
|
|
ansible.builtin.set_fact:
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
when:
|
|
- ansible_facts.os_family == 'Suse'
|
|
|
|
- name: Run the equivalent of "apt-get update && apt-get upgrade"
|
|
ansible.builtin.apt:
|
|
upgrade: safe
|
|
update_cache: true
|
|
when: ansible_facts.os_family == 'Debian'
|
|
|
|
- name: Install required python packages on Suse
|
|
ansible.builtin.command: zypper -n install python311-rpm python311-PyMySQL
|
|
changed_when: false
|
|
when: ansible_facts.os_family == 'Suse'
|
|
|
|
- name: Create missing directory
|
|
ansible.builtin.file:
|
|
path: /etc/mysql
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Determine required MySQL Python libraries (Ubuntu Focal Fossa ++)
|
|
ansible.builtin.set_fact:
|
|
mysql_python_package_debian: python3-pymysql
|
|
when:
|
|
- mysql_python_package_debian is not defined
|
|
- ansible_facts.distribution == "Ubuntu"
|
|
- ansible_facts.distribution_major_version|int > 19
|
|
|
|
- name: Install required MySQL Python libraries on RHEL
|
|
ansible.builtin.dnf:
|
|
name: "{% if 'python3' in ansible_python_interpreter | default('') %}python36-PyMySQL{% else %}python2-PyMySQL{% endif %}"
|
|
when:
|
|
- ansible_facts.os_family == "RedHat"
|
|
- ansible_facts.distribution_major_version == "7"
|
|
|
|
- name: Install mysql with a generic Ansible role
|
|
ansible.builtin.include_role:
|
|
name: dev-sec.mysql
|
|
|
|
- name: Include MySQL user prepare tasks
|
|
ansible.builtin.include_tasks: prepare_tasks/mysql_users.yml
|