From e9c5e116996a1d2bacc77265a161b691fef41ddf 2020-05-05 22:59:11 From: Branko Majic Date: 2020-05-05 22:59:11 Subject: [PATCH] MAR-152: Drop support for Debian 8 Jessie from the database_server role. --- diff --git a/docs/rolereference.rst b/docs/rolereference.rst index 1af1babd12d47e00a32dfe3f263f9fd2f0b7deae..363e6f6156116a2f1f7d85e33300cd6f8f53415a 100644 --- a/docs/rolereference.rst +++ b/docs/rolereference.rst @@ -1989,7 +1989,6 @@ Distribution compatibility Role is compatible with the following distributions: -- Debian 8 (Jessie) - Debian 9 (Stretch) diff --git a/roles/database_server/molecule/default/molecule.yml b/roles/database_server/molecule/default/molecule.yml index 5b36b39c729e27faf1a3234ecd9350ab77cedb4b..761eaa987c93a9f0842141b78771a3c932582080 100644 --- a/roles/database_server/molecule/default/molecule.yml +++ b/roles/database_server/molecule/default/molecule.yml @@ -14,13 +14,6 @@ lint: platforms: - - name: parameters-mandatory-jessie64 - groups: - - parameters-mandatory - box: debian/contrib-jessie64 - memory: 512 - cpus: 1 - - name: parameters-mandatory-stretch64 groups: - parameters-mandatory diff --git a/roles/database_server/molecule/default/tests/test_default.py b/roles/database_server/molecule/default/tests/test_default.py index 4fdc15330ff34839b7c70b5ff786a533afa532c4..34e72d2b57a789d93ea12b2f7b7caee2a3dacd84 100644 --- a/roles/database_server/molecule/default/tests/test_default.py +++ b/roles/database_server/molecule/default/tests/test_default.py @@ -74,6 +74,20 @@ def test_root_my_cnf_login(host): assert "performance_schema" in login.stdout +def test_utf8_configuration_file(host): + """ + Tests if UTF-8 database server configuration file has been deployed + correctly. + """ + + config = host.file('/etc/mysql/mariadb.conf.d/90-utf8.cnf') + + assert config.is_file + assert config.user == 'root' + assert config.group == 'root' + assert config.mode == 0o644 + + def test_utf8_configuration(host): """ Tests if UTF-8 configuration has been applied correctly to server. diff --git a/roles/database_server/molecule/default/tests/test_default_jessie64.py b/roles/database_server/molecule/default/tests/test_default_jessie64.py deleted file mode 100644 index 50c3f336e297aebc06e9e0c83223a364863e2f9d..0000000000000000000000000000000000000000 --- a/roles/database_server/molecule/default/tests/test_default_jessie64.py +++ /dev/null @@ -1,31 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-mandatory-jessie64') - - -def test_utf8_configuration_file(host): - """ - Tests if UTF-8 database server configuration file has been deployed - correctly. - """ - - config = host.file('/etc/mysql/conf.d/utf8.cnf') - - assert config.is_file - assert config.user == 'root' - assert config.group == 'root' - assert config.mode == 0o644 - - -def test_stretch_utf8_configuration_file_absent(host): - """ - Tests if the Stretch configuration file is absent. - """ - - config = host.file('/etc/mysql/mariadb.conf.d/90-utf8.cnf') - - assert not config.exists diff --git a/roles/database_server/molecule/default/tests/test_default_stretch64.py b/roles/database_server/molecule/default/tests/test_default_stretch64.py deleted file mode 100644 index 4ea7d6f6f5379f4d018670a4b903d572d8319a64..0000000000000000000000000000000000000000 --- a/roles/database_server/molecule/default/tests/test_default_stretch64.py +++ /dev/null @@ -1,31 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-mandatory-stretch64') - - -def test_utf8_configuration_file(host): - """ - Tests if UTF-8 database server configuration file has been deployed - correctly. - """ - - config = host.file('/etc/mysql/mariadb.conf.d/90-utf8.cnf') - - assert config.is_file - assert config.user == 'root' - assert config.group == 'root' - assert config.mode == 0o644 - - -def test_jessie_utf8_configuration_file_absent(host): - """ - Tests if the Jessie configuration file is absent. - """ - - config = host.file('/etc/mysql/conf.d/utf8.cnf') - - assert not config.exists diff --git a/roles/database_server/tasks/main.yml b/roles/database_server/tasks/main.yml index d945ce1d4ae3ed9046d8787ace1bacdde962f742..184a201f14348ee211e02c71f576c1d84c01cda6 100644 --- a/roles/database_server/tasks/main.yml +++ b/roles/database_server/tasks/main.yml @@ -32,48 +32,37 @@ group: root mode: 0400 -- name: Check if root user authentication is based on use of unix_socket module (Stretch default) +- name: Check if root user authentication is based on use of unix_socket module command: mysql --skip-column-names -B -e "select 1 from mysql.user where user='root' and plugin='unix_socket';" - when: "ansible_distribution_release == 'stretch'" register: "root_using_unix_socket_authentication" changed_when: false -- name: Disable use of unix socket login on Debian Stretch (temporary workaround) +# @TODO: This is essentially a leftover from the days of Debian +# Jessie, which by default did not use unix socket +# authentication for the root account. To make the deployment +# the same on both distros, unix socket authentication was +# disabled on Debian Stretch at the time. It might be worth the +# effort to revisit this and figure out if unix socket +# authentication should be reenabled instead (and whether +# password for the root account should be used at all). +- name: Disable use of unix socket login command: "mysql -B -e \"update mysql.user set plugin='' where user='root' and plugin='unix_socket'; flush privileges;\"" - when: "ansible_distribution_release == 'stretch' and root_using_unix_socket_authentication.stdout" + when: "root_using_unix_socket_authentication.stdout" -- name: Remove UTF-8 encoding configuration file from the old location on Debian Stretch - file: - path: "/etc/mysql/conf.d/utf8.cnf" - state: absent - when: "ansible_distribution_release == 'stretch'" - register: mariadb_utf8_configuration_stretch - -- name: Set UTF-8 encoding as default for MariaDB (on Jessie) - copy: - src: "utf8.cnf" - dest: "/etc/mysql/conf.d/utf8.cnf" - owner: root - group: root - mode: 0644 - when: "ansible_distribution_release == 'jessie'" - register: mariadb_utf8_configuration_jessie - -- name: Set UTF-8 encoding as default for MariaDB (on Stretch) +- name: Set UTF-8 encoding as default for MariaDB copy: src: "utf8.cnf" dest: "/etc/mysql/mariadb.conf.d/90-utf8.cnf" owner: root group: root mode: 0644 - when: "ansible_distribution_release == 'stretch'" - register: mariadb_utf8_configuration_stretch + register: mariadb_utf8_configuration - name: Restart MariaDB in order to use UTF-8 as default character set service: name: mysql state: restarted - when: mariadb_utf8_configuration_jessie.changed or mariadb_utf8_configuration_stretch.changed + when: mariadb_utf8_configuration.changed tags: # [ANSIBLE0016] Tasks that run when changed should likely be handlers # UTF-8 configuration must be applied immediatelly in order to ensure that