Skip to content

Commit

Permalink
🐛 Fix MariaDB apt-key is deprecated failure
Browse files Browse the repository at this point in the history
  • Loading branch information
retlehs committed Apr 18, 2024
1 parent 0b1fff7 commit c512063
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
2 changes: 0 additions & 2 deletions roles/mariadb/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
mariadb_version: 10.6
mariadb_keyserver: "hkp://keyserver.ubuntu.com:80"
mariadb_keyserver_id: "0xF1656F24C74CD1D8"
mariadb_ppa: "deb https://mirror.rackspace.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release }} main"

mariadb_client_package: mariadb-client
Expand Down
41 changes: 29 additions & 12 deletions roles/mariadb/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
---
- block:
- name: Add MariaDB APT key
apt_key:
keyserver: "{{ mariadb_keyserver }}"
id: "{{ mariadb_keyserver_id }}"
- name: Download MariaDB GPG key
ansible.builtin.get_url:
url: "https://mariadb.org/mariadb_release_signing_key.asc"
dest: "/tmp/mariadb_release_signing_key.asc"
mode: '0644'

- name: Add the MariaDB GPG key to apt
ansible.builtin.shell:
cmd: "apt-key add /tmp/mariadb_release_signing_key.asc"
args:
removes: "/tmp/mariadb_release_signing_key.asc"

- name: Setup MariaDB repository
ansible.builtin.copy:
dest: "/etc/apt/sources.list.d/mariadb.list"
content: |
# Ansible managed
{{ mariadb_ppa }}
mode: "0644"

- name: Add MariaDB PPA
apt_repository:
repo: "{{ mariadb_ppa }}"
update_cache: yes
- name: Install necessary packages for repository management
ansible.builtin.apt:
name:
- apt-transport-https
- gnupg
state: present
update_cache: true

- name: Install MySQL client
apt:
ansible.builtin.apt:
name: "{{ mariadb_client_package }}"
state: "{{ mariadb_client_package_state | default(apt_package_state) }}"
cache_valid_time: "{{ apt_cache_valid_time }}"
update_cache: true

- block:
- name: Install MySQL server
apt:
ansible.builtin.apt:
name: "{{ mariadb_server_package }}"
state: "{{ mariadb_server_package_state | default(apt_package_state) }}"
cache_valid_time: "{{ apt_cache_valid_time }}"
Expand Down

0 comments on commit c512063

Please sign in to comment.