diff --git a/roles/zabbix_proxy/tasks/initialize-mysql.yml b/roles/zabbix_proxy/tasks/initialize-mysql.yml index fb7b0cec8..5db230a4c 100644 --- a/roles/zabbix_proxy/tasks/initialize-mysql.yml +++ b/roles/zabbix_proxy/tasks/initialize-mysql.yml @@ -17,20 +17,14 @@ # NOTE: Upgrading system-packages with pip is generally a bad idea, but # these packaged older versions seems to have a problem with mysql 8 and above -- name: Check if pymysql should be upgraded - ansible.builtin.set_fact: - __upgrade_debian_pymysql: "{{ (ansible_facts['distribution'] in ['CentOS', 'Debian', 'Ubuntu'] and ansible_facts['distribution_release'] in ['Core', 'buster', 'bullseye', 'bionic', 'focal']) }}" - __upgrade_suse_pymysql: "{{ ansible_facts['os_family'] in ['Suse'] }}" - tags: - - install - - database - - dependencies - - name: Upgrade pymysql - when: __upgrade_debian_pymysql or __upgrade_suse_pymysql + when: _upgrade_debian_pymysql or _upgrade_suse_pymysql ansible.builtin.pip: name: "pymysql>=0.10.0,<0.11.0" state: latest + vars: + _upgrade_debian_pymysql: "{{ (ansible_facts['distribution'] in ['Debian', 'Ubuntu'] and ansible_facts['distribution_release'] in ['bullseye', 'focal']) }}" + _upgrade_suse_pymysql: "{{ ansible_facts['os_family'] in ['Suse'] }}" tags: - install - database diff --git a/roles/zabbix_server/tasks/initialize-mysql.yml b/roles/zabbix_server/tasks/initialize-mysql.yml index ccd50e4f8..d66a2e75b 100644 --- a/roles/zabbix_server/tasks/initialize-mysql.yml +++ b/roles/zabbix_server/tasks/initialize-mysql.yml @@ -16,20 +16,14 @@ # NOTE: Upgrading system-packages with pip is generally a bad idea, but # these packaged older versions seems to have a problem with mysql 8 and above -- name: Check if pymysql should be upgraded - ansible.builtin.set_fact: - __upgrade_debian_pymysql: "{{ (ansible_facts['distribution'] in ['Debian', 'Ubuntu'] and ansible_facts['distribution_release'] in ['bullseye', 'focal']) }}" - __upgrade_suse_pymysql: "{{ ansible_facts['os_family'] in ['Suse'] }}" - tags: - - install - - database - - dependencies - - name: Upgrade pymysql - when: __upgrade_debian_pymysql or __upgrade_suse_pymysql + when: _upgrade_debian_pymysql or _upgrade_suse_pymysql ansible.builtin.pip: name: "pymysql>=0.10.0,<0.11.0" state: latest + vars: + _upgrade_debian_pymysql: "{{ (ansible_facts['distribution'] in ['Debian', 'Ubuntu'] and ansible_facts['distribution_release'] in ['bullseye', 'focal']) }}" + _upgrade_suse_pymysql: "{{ ansible_facts['os_family'] in ['Suse'] }}" tags: - install - database