--- - name: "Add MariaDB repo key" apt_key: keyserver: keyserver.ubuntu.com id: "0xF1656F24C74CD1D8" state: present - name: "Pin MariaDB repo" template: src: "mariadb_repo.j2" dest: "/etc/apt/preferences.d/mariadb" become: True # Using the automatic file naming of apt_repository, the version number is included # in the apt list file. This results in new list files on every version upgrade. # Switched to a static name. Here, old files are cleaned up. - name: "Remove old style MariaDB repo files" file: path: "/etc/apt/sources.list.d/{{ item }}" state: absent with_items: - ams2_mirrors_digitalocean_com_mariadb_repo_10_1_ubuntu.list - ams2_mirrors_digitalocean_com_mariadb_repo_10_3_ubuntu.list - name: "Add MariaDB repo" apt_repository: repo: "deb [arch=amd64] http://{{ mariadb_origin }}/mariadb/repo/{{ mariadb_version }}/{{ vars.distribution }} {{ vars.distribution_codename }} main" filename: mariadb state: present