Skip to content

Commit

Permalink
chore: simplify pymysql upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
jon4hz committed Jun 12, 2024
1 parent 828655d commit ab7b64a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
14 changes: 4 additions & 10 deletions roles/zabbix_proxy/tasks/initialize-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions roles/zabbix_server/tasks/initialize-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ab7b64a

Please sign in to comment.