Skip to content

Commit

Permalink
feat: added Linux Mint Support (#515)
Browse files Browse the repository at this point in the history
* feat: added Linux Mint Support

* feat: added linuxmint test image, added meta information, added automatic resolution of apt repo codename

* fix: fixed linter warnings

* fix: introduced common.yaml as shared dependency among debian install and uninstall

* fix: renamed apt-codename.yml dependency

* Fix typo in apt-codename.yml
  • Loading branch information
fkonradmain authored Dec 13, 2024
1 parent 1e5f1d2 commit d769661
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 2 deletions.
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
- 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" |
- 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

0 comments on commit d769661

Please sign in to comment.