* Include Debian 11 into Molecule test suites (#527) Signed-off-by: Daya Adianto <[email protected]> * Fix Ansible Lint GitHub Action version (#527) Signed-off-by: Daya Adianto <[email protected]> * Update .gitignore Signed-off-by: Daya Adianto <[email protected]> * mysql_hardening: Use Python 3 as Ansible interpreter (#527) Signed-off-by: Daya Adianto <[email protected]> * Note Debian 11 support for os_hardening & nginx_hardening (#527) Signed-off-by: Daya Adianto <[email protected]> * Fix lint issues & Ansible Lint configuration in CI Signed-off-by: Daya Adianto <[email protected]> * Try to fix YAML lint issues, again Re-ordered YAML comments at the end of `.yamllint` file. Signed-off-by: Daya Adianto <[email protected]> * rm debian9 from tests, add debian 11 where missing Signed-off-by: Sebastian Gumprich <[email protected]> * fix mysql molecule tests Signed-off-by: Sebastian Gumprich <[email protected]> Signed-off-by: Daya Adianto <[email protected]> Signed-off-by: Sebastian Gumprich <[email protected]> Co-authored-by: Sebastian Gumprich <[email protected]> Co-authored-by: Sebastian Gumprich <[email protected]>
74 lines
2.4 KiB
YAML
74 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) }}"
|
|
tasks:
|
|
- name: Use Python 3 on Debian 11
|
|
set_fact:
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
when:
|
|
- ansible_distribution == 'Debian'
|
|
- ansible_distribution_major_version|int >= 11
|
|
|
|
- name: Use Python 2 on Debian 10
|
|
set_fact:
|
|
ansible_python_interpreter: /usr/bin/python
|
|
when:
|
|
- ansible_distribution == 'Debian'
|
|
- ansible_distribution_major_version|int == 10
|
|
|
|
- name: Run the equivalent of "apt-get update && apt-get upgrade"
|
|
apt:
|
|
name: "*"
|
|
state: latest
|
|
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: create missing directory
|
|
file:
|
|
path: "/etc/mysql/conf.d"
|
|
state: directory
|
|
|
|
- name: Determine required MySQL Python libraries (Ubuntu Focal Fossa ++)
|
|
set_fact:
|
|
mysql_python_package_debian: "python3-pymysql"
|
|
when:
|
|
- mysql_python_package_debian is not defined
|
|
- ansible_distribution == "Ubuntu"
|
|
- ansible_distribution_major_version|int > 19
|
|
|
|
- name: Determine required MySQL Python libraries.
|
|
set_fact:
|
|
mysql_python_package_debian: "{% if 'python3' in ansible_python_interpreter|default('') %}python3-mysqldb{% else %}python-mysqldb{% endif %}"
|
|
when:
|
|
- mysql_python_package_debian is not defined
|
|
- ansible_distribution != "Ubuntu"
|
|
- ansible_distribution_major_version|int < 20
|
|
|
|
|
|
- include_role:
|
|
name: dev-sec.mysql
|
|
|
|
- name: create a user with an empty password
|
|
community.mysql.mysql_query:
|
|
query:
|
|
- "CREATE USER foo@bar;"
|
|
login_unix_socket: "{{ login_unix_socket | 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
|