--- - name: Install mariadb repo necessary packages ansible.builtin.apt: package: - apt-transport-https - gnupg2 state: present update_cache: true when: mariadb_use_official_repo - name: Install mariadb repository key ansible.builtin.apt_key: keyserver: keyserver.ubuntu.com id: "0xF1656F24C74CD1D8" when: mariadb_use_official_repo - name: Setup mariadb repository sourcelist entry ansible.builtin.apt_repository: repo: deb {{ mariadb_use_official_repo_url }}/{{ mariadb_use_official_repo_version }}/{{ ansible_distribution | lower() }} {{ ansible_distribution_release }} main filename: mariadb state: present when: mariadb_use_official_repo - name: Install mariadb ansible.builtin.apt: package: - mariadb-server state: present update_cache: true - name: Install python mariadb driver ansible.builtin.apt: name: python3-pymysql state: present