mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
156 lines
4.8 KiB
YAML
156 lines
4.8 KiB
YAML
---
|
|
- name: Gather installed package facts
|
|
tags: [packages]
|
|
ansible.builtin.package_facts:
|
|
manager: auto
|
|
|
|
- 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: Ensure Docker apt keyrings directory exists
|
|
tags: [packages]
|
|
ansible.builtin.file:
|
|
path: /etc/apt/keyrings
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
when: ubuntu_manage_docker_repo | default(false)
|
|
|
|
- name: Download Docker apt repository signing key
|
|
tags: [packages]
|
|
ansible.builtin.get_url:
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
dest: /etc/apt/keyrings/docker.asc
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
when: ubuntu_manage_docker_repo | default(false)
|
|
|
|
- name: Configure Docker apt repository
|
|
tags: [packages]
|
|
ansible.builtin.apt_repository:
|
|
repo: >-
|
|
deb [arch={{ 'amd64' if ansible_facts['architecture'] == 'x86_64'
|
|
else 'arm64' if ansible_facts['architecture'] in ['aarch64', 'arm64']
|
|
else ansible_facts['architecture'] }}
|
|
signed-by=/etc/apt/keyrings/docker.asc]
|
|
https://download.docker.com/linux/ubuntu
|
|
{{ ansible_facts['distribution_release'] }} stable
|
|
filename: docker
|
|
state: present
|
|
update_cache: true
|
|
when: ubuntu_manage_docker_repo | default(false)
|
|
|
|
- name: Refresh apt package cache
|
|
tags: [packages]
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
- name: Install packages on Ubuntu
|
|
tags: [packages]
|
|
ansible.builtin.apt:
|
|
name: >-
|
|
{{
|
|
(
|
|
(common_packages | default([]))
|
|
+ (ubuntu_packages_base | default([]))
|
|
+ (ubuntu_docker_packages | default([]))
|
|
+ (profile_packages | default([]))
|
|
+ (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([]))
|
|
+ (
|
|
(desktop_i3_packages | default([]))
|
|
if 'i3' in (desktop_sessions_enabled | default([]))
|
|
else []
|
|
)
|
|
+ (
|
|
(desktop_hyprland_packages | default([]))
|
|
if 'hyprland' in (desktop_sessions_enabled | default([]))
|
|
else []
|
|
)
|
|
+ (host_packages | default([]))
|
|
)
|
|
| difference(
|
|
(workstation_dev_wsl_excluded_packages | default([]))
|
|
if 'workstation_dev_wsl' in group_names
|
|
else []
|
|
)
|
|
| unique
|
|
}}
|
|
state: present
|
|
|
|
- name: Add user to docker group
|
|
tags: [packages]
|
|
ansible.builtin.user:
|
|
name: "{{ effective_username }}"
|
|
groups: docker
|
|
append: true
|
|
when: (ubuntu_docker_packages | default([])) | length > 0
|
|
|
|
- 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
|