Refactor workstation to Fedora WSL target

This commit is contained in:
Fabio Scotto di Santolo
2026-08-28 11:41:14 +02:00
parent 3f0654a4bd
commit a6a58245ff
18 changed files with 48 additions and 953 deletions

View File

@@ -1,9 +1,4 @@
---
- name: Gather installed package facts
tags: [packages]
ansible.builtin.package_facts:
manager: auto
- name: Copy Ubuntu dotfiles
tags: [dotfiles, dotfiles:common]
ansible.builtin.copy:
@@ -16,75 +11,6 @@
loop_control:
label: "{{ item.dest }}"
- name: Ensure architecture is supported for Google Chrome
tags: [packages]
ansible.builtin.fail:
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for Google Chrome stable package"
when:
- workstation_manage_google_chrome | default(false)
- ansible_facts['architecture'] != 'x86_64'
- name: Download Google Chrome Debian package
tags: [packages]
ansible.builtin.get_url:
url: https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dest: /tmp/google-chrome-stable_current_amd64.deb
mode: "0644"
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Install Google Chrome from downloaded Debian package
tags: [packages]
ansible.builtin.apt:
deb: /tmp/google-chrome-stable_current_amd64.deb
state: present
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Remove downloaded Google Chrome Debian package
tags: [packages]
ansible.builtin.file:
path: /tmp/google-chrome-stable_current_amd64.deb
state: absent
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Download glab Debian package
tags: [packages]
ansible.builtin.get_url:
url: >-
https://gitlab.com/gitlab-org/cli/-/releases/v{{ workstation_glab_version }}/downloads/glab_{{ workstation_glab_version }}_linux_{{
'amd64' if ansible_facts['architecture'] == 'x86_64'
else 'arm64' if ansible_facts['architecture'] in ['aarch64', 'arm64']
else ansible_facts['architecture']
}}.deb
dest: "/tmp/glab_{{ workstation_glab_version }}.deb"
mode: "0644"
when:
- workstation_manage_glab | default(false)
- ansible_facts.packages['glab'] is not defined or ansible_facts.packages['glab'][0].version != workstation_glab_version
- name: Install glab from downloaded Debian package
tags: [packages]
ansible.builtin.apt:
deb: "/tmp/glab_{{ workstation_glab_version }}.deb"
state: present
when:
- workstation_manage_glab | default(false)
- ansible_facts.packages['glab'] is not defined or ansible_facts.packages['glab'][0].version != workstation_glab_version
- name: Remove downloaded glab Debian package
tags: [packages]
ansible.builtin.file:
path: "/tmp/glab_{{ workstation_glab_version }}.deb"
state: absent
when:
- workstation_manage_glab | default(false)
- ansible_facts.packages['glab'] is not defined or ansible_facts.packages['glab'][0].version != workstation_glab_version
- name: Ensure Docker apt keyrings directory exists
tags: [packages]
ansible.builtin.file:
@@ -141,25 +67,8 @@
if (emacs_enabled | default(false) | bool)
else []
)
+ (workstation_dev_packages | default([]))
+ (
(workstation_host_linux_packages | default([]))
if 'workstation_host_linux' in group_names
else []
)
+ (
(workstation_dev_wsl_packages | default([]))
if 'workstation_dev_wsl' in group_names
else []
)
+ (desktop_common_packages | default([]))
+ (host_packages | default([]))
)
| difference(
(workstation_dev_wsl_excluded_packages | default([]))
if 'workstation_dev_wsl' in group_names
else []
)
| unique
}}
state: present
@@ -171,127 +80,3 @@
groups: docker
append: true
when: (ubuntu_docker_packages | default([])) | length > 0
- name: Ensure architecture is supported for croc GitHub release
tags: [packages]
ansible.builtin.fail:
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for croc GitHub release"
when:
- workstation_manage_croc | default(false)
- ansible_facts['architecture'] not in ['x86_64', 'aarch64', 'arm64']
- name: Read installed croc version
tags: [packages]
ansible.builtin.command: /usr/local/bin/croc --version
register: croc_version_check
changed_when: false
failed_when: false
check_mode: false
when: workstation_manage_croc | default(false)
- name: Ensure temporary croc extraction directory is absent
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}"
state: absent
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Create temporary croc extraction directory
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}"
state: directory
owner: root
group: root
mode: "0755"
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Download croc GitHub release archive
tags: [packages]
ansible.builtin.get_url:
url: >-
{{
'https://github.com/schollz/croc/releases/download/'
~ workstation_croc_version
~ '/croc_'
~ workstation_croc_version
~ '_Linux-'
~ (
'64bit' if ansible_facts['architecture'] == 'x86_64'
else 'ARM64' if ansible_facts['architecture'] in ['aarch64', 'arm64']
else ansible_facts['architecture']
)
~ '.tar.gz'
}}
dest: "/tmp/croc_{{ workstation_croc_version }}.tar.gz"
mode: "0644"
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Extract croc GitHub release archive
tags: [packages]
ansible.builtin.unarchive:
src: "/tmp/croc_{{ workstation_croc_version }}.tar.gz"
dest: "/tmp/croc_{{ workstation_croc_version }}"
remote_src: true
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Install croc binary
tags: [packages]
ansible.builtin.copy:
src: "/tmp/croc_{{ workstation_croc_version }}/croc"
dest: /usr/local/bin/croc
owner: root
group: root
mode: "0755"
remote_src: true
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Remove downloaded croc archive
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}.tar.gz"
state: absent
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Remove temporary croc extraction directory
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}"
state: absent
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Remove workstation snap packages
tags: [packages]
community.general.snap:
name: "{{ item }}"
state: absent
loop: "{{ workstation_removed_snap_packages | default([]) }}"
loop_control:
label: "{{ item }}"
when: (workstation_removed_snap_packages | default([])) | length > 0
- name: Install workstation snap packages
tags: [packages]
community.general.snap:
name: "{{ item.name }}"
classic: "{{ item.classic | default(false) }}"
channel: "{{ item.channel | default(omit) }}"
state: present
loop: "{{ workstation_snap_packages | default([]) }}"
loop_control:
label: "{{ item.name }}"
when: (workstation_snap_packages | default([])) | length > 0