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

Added support for Debian doesn't work for Ubuntu #65

Open
hugopeek opened this issue Mar 8, 2023 · 2 comments
Open

Added support for Debian doesn't work for Ubuntu #65

hugopeek opened this issue Mar 8, 2023 · 2 comments

Comments

@hugopeek
Copy link

hugopeek commented Mar 8, 2023

          Thank you for taking the time to submit this PR. Support for Debian was added with #45, which should work for Ubuntu as well?

Originally posted by @bertvv in #43 (comment)

@bertvv Just wanted to note here that the added Debian support does not apply to Ubuntu as well. It is acting specifically on the ansible_distribution variable, which would be Ubuntu in this case.

This could be solved by using the ansible_os_family var instead, which in the case of Ubuntu, will return Debian.

I don't know how this would affect scenarios on other distros, but if I end up using this role, I'll try to submit a PR.

Thank you for your efforts!

@clahil-linum
Copy link

clahil-linum commented Mar 11, 2023

I can confirm this behaviour. With this little changes it seems to work:

diff -urN bertvv.mariadb bertvv.mariadb.ubuntu
diff -urN bertvv.mariadb/meta/.galaxy_install_info bertvv.mariadb.ubuntu/meta/.galaxy_install_info
--- bertvv.mariadb/meta/.galaxy_install_info    2023-03-11 12:50:15.897279432 +0000
+++ bertvv.mariadb.ubuntu/meta/.galaxy_install_info     2023-03-09 15:07:18.227104627 +0000
@@ -1,2 +1,2 @@
-install_date: Sat Mar 11 12:50:15 2023
+install_date: Thu Mar  9 15:07:18 2023
 version: v3.1.3
diff -urN bertvv.mariadb/tasks/add-repo.yml bertvv.mariadb.ubuntu/tasks/add-repo.yml
--- bertvv.mariadb/tasks/add-repo.yml   2022-10-14 09:52:18.000000000 +0000
+++ bertvv.mariadb.ubuntu/tasks/add-repo.yml    2023-03-11 12:36:13.149309261 +0000
@@ -6,7 +6,7 @@
     src: etc_yum.repos.d_mariadb.repo.j2
     dest: /etc/yum.repos.d/MariaDB.repo
     mode: '0644'
-  when: ansible_distribution != 'Debian'
+  when: ansible_os_family != 'Debian'
   tags: mariadb


@@ -14,14 +14,14 @@
   package:
     name: gpg
     state: latest
-  when: ansible_distribution == 'Debian'
+  when: ansible_os_family == 'Debian'
   tags: mariadb

 - name: Add official MariaDB repository key (apt)
   apt_key:
     url: https://mariadb.org/mariadb_release_signing_key.asc
     state: present
-  when: ansible_distribution == 'Debian'
+  when: ansible_os_family == 'Debian'
   tags: mariadb

 - name: Add official MariaDB repository (apt)
@@ -29,11 +29,11 @@
     src: etc_apt_sources.list.d_mariadb.list.j2
     dest: /etc/apt/sources.list.d/mariadb.list
     mode: '0644'
-  when: ansible_distribution == 'Debian'
+  when: ansible_os_family == 'Debian'
   tags: mariadb

 - name: Update packages cache with new repo (apt)
   apt:
     update_cache: true
-  when: ansible_distribution == 'Debian'
+  when: ansible_os_family == 'Debian'
   tags: mariadb
diff -urN bertvv.mariadb/tasks/install.yml bertvv.mariadb.ubuntu/tasks/install.yml
--- bertvv.mariadb/tasks/install.yml    2022-10-14 09:52:18.000000000 +0000
+++ bertvv.mariadb.ubuntu/tasks/install.yml     2023-03-11 12:48:09.173283918 +0000
@@ -29,5 +29,5 @@
 - name: Install packages
   package:
     name: "{{ mariadb_packages }}"
-    state: "{{ 'latest' if ansible_distribution == 'Debian' else 'installed' }}"
+    state: "{{ 'latest' if ansible_os_family == 'Debian' else 'installed' }}"
   tags: mariadb
diff -urN bertvv.mariadb/templates/etc_apt_sources.list.d_mariadb.list.j2 bertvv.mariadb.ubuntu/templates/etc_apt_sources.list.d_mariadb.list.j2
--- bertvv.mariadb/templates/etc_apt_sources.list.d_mariadb.list.j2     2022-10-14 09:52:18.000000000 +0000
+++ bertvv.mariadb.ubuntu/templates/etc_apt_sources.list.d_mariadb.list.j2      2023-03-11 12:46:11.013288100 +0000
@@ -1,4 +1,9 @@
 # MariaDB repository list - Ansible managed
 # http://downloads.mariadb.org/mariadb/repositories/
+{% if ansible_distribution == 'Debian' %}
 deb [arch=amd64] http://{{ mariadb_mirror }}/{{ mariadb_version }}/debian {{ ansible_distribution_release }} main
 deb-src http://{{ mariadb_mirror }}/{{ mariadb_version }}/debian {{ ansible_distribution_release }} main
+{% else %}
+deb [arch=amd64] http://{{ mariadb_mirror }}/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release }} main
+deb-src http://{{ mariadb_mirror }}/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release }} main
+{%endif %}
\ No newline at end of file

@jashuRc
Copy link

jashuRc commented Jun 7, 2023

+1

"msg": "Failed to update apt cache: W:Updating from such a repository can't be done securely, and is therefore disabled by default., W:See apt-secure(8) manpage for repository creation and user configuration details., E:The repository 'http://mirror.mva-n.net/mariadb/repo/10.4/debian focal Release' does not have a Release file."}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants