Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix MariaDB apt-key is deprecated failure #1515

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the built-in url feature of apt_key? https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_key_module.html

- name: Add an Apt signing key, uses whichever key is at the URL
  ansible.builtin.apt_key:
    url: https://ftp-master.debian.org/keys/archive-key-6.0.asc
    state: present

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fatal: [default]: FAILED! => {"after": ["D94AA3F0EFE21092", "871920D1991BC93C"], "before": ["D94AA3F0EFE21092", "871920D1991BC93C"], "changed": true, "fp": "AED4B06F473041FA", "id": "AED4B06F473041FA", "key_id": "AED4B06F473041FA", "msg": "apt-key did not return an error, but failed to add the key (check that the id is correct and *not* a subkey)", "short_id": "473041FA"}


- name: Setup MariaDB repository
ansible.builtin.copy:
dest: "/etc/apt/sources.list.d/mariadb.list"
content: |
# Ansible managed
{{ mariadb_ppa }}
mode: "0644"
retlehs marked this conversation as resolved.
Show resolved Hide resolved

- 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
Loading