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

feat: added Linux Mint Support #515

Merged
merged 8 commits into from
Dec 13, 2024
1 change: 1 addition & 0 deletions .github/workflows/pull_request_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- image: ghcr.io/artis3n/docker-rhel8-ansible:latest
- image: ghcr.io/artis3n/docker-oraclelinux8-ansible:latest
- image: geerlingguy/docker-ubuntu2404-ansible:latest
- image: ghcr.io/fkonradmain/docker-linuxmint22-ansible:latest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@artis3n I don't see this pop up in the test suite. Does this need additional approval from your side as owner or did I miss anything?

Copy link
Owner

Choose a reason for hiding this comment

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

pull_request_target works by running the version of this file on the main branch against the code we check out. Needed to safely use my tailscale key to run the CI. Side effect is any changes to this file won't reflect in tests until it is merged.

To test this container, I run MOLECULE_DISTRO="ghcr.io/fkonradmain/docker-linuxmint22-ansible:latest" make test locally (or the other test commands in the Makefile)

- image: geerlingguy/docker-ubuntu2204-ansible:latest
- image: geerlingguy/docker-ubuntu2004-ansible:latest
- image: geerlingguy/docker-ubuntu1804-ansible:latest
Expand Down
5 changes: 5 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ galaxy_info:
- "15.4"
- "15.5"
# - "15.6"
# Linux Mint not supported in schema
# https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta.json
# - name: LinuxMint
# versions:
# - "22"

galaxy_tags:
- tailscale
Expand Down
33 changes: 33 additions & 0 deletions tasks/debian/apt-codename.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# Retrieve "ID_LIKE" from /etc/os-release
# ID_LIKE has the following values, depending on the operating system
# | OS | ID_LIKE |
# | Debian | -- does not exist -- |
# | Raspberry Pi OS | -- does not exist -- |
# | Proxmox | -- does not exist -- |
# | Devuan | "debian" |
# | Raspbian | "debian" |
# | Ubuntu | "debian" |
# | Pop!OS | "ubuntu debian" |
# | Linux Mint | "ubuntu debian" |
Comment on lines +2 to +12
Copy link
Owner

Choose a reason for hiding this comment

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

Great comment block, thank you!

- name: Debian | Retrieve Apt ID_LIKE
check_mode: false
ansible.builtin.command: >-
awk -F= '/^ID_LIKE/ {print $2}' {{ ansible_distribution_file_path }}
register: apt_id_like
changed_when: false

# Ubuntu and its derivatives all have a value called "UBUNTU_CODENAME" set in their "/etc/os-release"
# This value points to the actual ubuntu Version.
# Ansible does not pick up that value on setup. Usually it picks up "VERSION_CODENAME"
- name: Debian | Retrieve ubuntu_codename on Ubuntu derivatives
check_mode: false
ansible.builtin.command: >-
awk -F= '/^UBUNTU_CODENAME/ {print $2}' {{ ansible_distribution_file_path }}
register: ubuntu_codename
when: apt_id_like.stdout == '"ubuntu debian"'
changed_when: false

- name: Debian | Set codename for apt
ansible.builtin.set_fact:
apt_codename: "{{ ubuntu_codename.stdout | default(ansible_distribution_release) }}"
5 changes: 5 additions & 0 deletions tasks/debian/install.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: Debian | Include apt codename generation tasks
ansible.builtin.include_tasks:
file: apt-codename.yml

- name: Debian | Apt Dependencies
become: true
ansible.builtin.apt:
Expand Down Expand Up @@ -29,6 +33,7 @@
repo: "{{ tailscale_apt_deb }}"
filename: "tailscale"
state: present
codename: "{{ apt_codename }}"

- name: Debian | Install Tailscale
become: true
Expand Down
5 changes: 5 additions & 0 deletions tasks/debian/uninstall.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: Debian | Include apt codename generation tasks
ansible.builtin.include_tasks:
file: apt-codename.yml

- name: Debian | Apt Dependencies
become: true
ansible.builtin.apt:
Expand All @@ -17,6 +21,7 @@
ansible.builtin.apt_repository:
repo: "{{ tailscale_apt_deb }}"
state: absent
codename: "{{ apt_codename }}"

- name: Debian | Remove Tailscale Signing Key from trusted.gpg
become: true
Expand Down
6 changes: 4 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ tailscale_debian_family_distros:
- Debian
- Pop!_OS
- OSMC
- "Linux Mint"

tailscale_centos_family_distros:
- CentOS
Expand Down Expand Up @@ -36,12 +37,13 @@ tailscale_debian_distro:
ubuntu: ubuntu
debian: debian
osmc: debian
"linux mint": ubuntu

tailscale_apt_keyring_path: /usr/share/keyrings/tailscale-archive-keyring.gpg

tailscale_apt_deb: deb [signed-by={{ tailscale_apt_keyring_path }}] https://pkgs.tailscale.com/{{ release_stability | lower }}/{{ tailscale_debian_distro[ansible_distribution | lower] }} {{ ansible_distribution_release | lower }} main
tailscale_apt_deb: deb [signed-by={{ tailscale_apt_keyring_path }}] https://pkgs.tailscale.com/{{ release_stability | lower }}/{{ tailscale_debian_distro[ansible_distribution | lower] }} {{ apt_codename | lower }} main

tailscale_apt_signkey: https://pkgs.tailscale.com/{{ release_stability | lower }}/{{ tailscale_debian_distro[ansible_distribution | lower] }}/{{ ansible_distribution_release | lower }}.noarmor.gpg
tailscale_apt_signkey: https://pkgs.tailscale.com/{{ release_stability | lower }}/{{ tailscale_debian_distro[ansible_distribution | lower] }}/{{ apt_codename | lower }}.noarmor.gpg

tailscale_yum_dependencies:
- yum-utils
Expand Down
Loading