2020-11-07 20:19:43 +00:00
|
|
|
---
|
2023-12-06 10:18:56 +00:00
|
|
|
- name: Wrapper playbook for kitchen testing "ansible-mysql-hardening"
|
2020-11-07 20:19:43 +00:00
|
|
|
hosts: all
|
|
|
|
become: true
|
2021-03-19 14:45:06 +00:00
|
|
|
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) }}"
|
2020-11-07 20:19:43 +00:00
|
|
|
tasks:
|
|
|
|
- name: Determine required MySQL Python libraries (Ubuntu Focal Fossa ++)
|
2023-12-06 10:18:56 +00:00
|
|
|
ansible.builtin.set_fact:
|
2023-12-06 13:37:09 +00:00
|
|
|
mysql_python_package_debian: python3-pymysql
|
2020-11-07 20:19:43 +00:00
|
|
|
when:
|
|
|
|
- mysql_python_package_debian is not defined
|
|
|
|
- ansible_distribution == "Ubuntu"
|
|
|
|
- ansible_distribution_major_version|int > 19
|
|
|
|
|
|
|
|
- name: Determine required MySQL Python libraries.
|
2023-12-06 10:18:56 +00:00
|
|
|
ansible.builtin.set_fact:
|
2023-12-06 13:37:09 +00:00
|
|
|
mysql_python_package_debian: "{% if 'python3' in ansible_python_interpreter | default('') %}python3-mysqldb{% else %}python-mysqldb{% endif %}"
|
2020-11-07 20:19:43 +00:00
|
|
|
when:
|
|
|
|
- mysql_python_package_debian is not defined
|
|
|
|
- ansible_distribution != "Ubuntu"
|
|
|
|
- ansible_distribution_major_version|int < 20
|
2022-11-29 14:09:27 +00:00
|
|
|
|
|
|
|
- name: Use Python 3 on Suse
|
2023-12-06 10:18:56 +00:00
|
|
|
ansible.builtin.set_fact:
|
2022-11-29 14:09:27 +00:00
|
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'Suse'
|
|
|
|
|
2023-12-06 10:18:56 +00:00
|
|
|
- name: Include mysql_hardening role
|
|
|
|
ansible.builtin.include_role:
|
|
|
|
name: devsec.hardening.mysql_hardening
|
2020-11-07 20:19:43 +00:00
|
|
|
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
|