-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdesktop.yml
More file actions
120 lines (103 loc) · 3.98 KB
/
desktop.yml
File metadata and controls
120 lines (103 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# This playbook is for getting things which
# are useful on the graphical desktop.
---
- name: Desktop setup
hosts: all
pre_tasks:
- name: Install desktop tools
include_role:
name: tools
tasks_from: rpm
vars:
rpms: "{{ desktop_packages }}"
- name: Ensure dnf PR plugin is installed
dnf:
name: dnf-plugins-core
state: "{{ package_state_default }}"
become: true
- name: Enable COPR repo for rofi (yaroslav/i3desktop) on older Fedora
command: dnf -y copr enable yaroslav/i3desktop
when: ansible_distribution == "Fedora" and (ansible_distribution_major_version | int) < 43
- name: Install rofi from COPR repository
dnf:
name: rofi
enablerepo: yaroslav/i3desktop
state: "{{ package_state_default }}"
become: true
- name: Setup desktop files in /home folder
include_role:
name: tools
tasks_from: file
vars:
files_src: "home/desktop/"
files_dst: "{{ ansible_user_dir }}"
- name: Find user avatar image by username in Avatars folder
ansible.builtin.find:
paths: "{{ desktop_avatar_dir | default(ansible_user_dir ~ '/Pictures/Avatars') }}"
patterns:
- "{{ ansible_user_id }}.jpg"
- "{{ ansible_user_id }}.jpeg"
- "{{ ansible_user_id }}.png"
- "{{ ansible_user_id }}.webp"
file_type: file
recurse: false
register: avatar_matches
- name: Pick detected avatar file (first match)
set_fact:
desktop_avatar_file_detected: >-
{{ (avatar_matches.files
| sort(attribute='path')
| map(attribute='path')
| list
| first) | default('') }}
- name: Ensure ~/.face is set from avatar URL (if provided)
get_url:
url: "{{ desktop_avatar_url }}"
dest: "{{ ansible_user_dir }}/.face"
mode: "0644"
when: desktop_avatar_url is defined and desktop_avatar_url | length > 0
- name: Ensure ~/.face is a symlink to detected avatar file (default)
file:
src: "{{ desktop_avatar_file_detected }}"
dest: "{{ ansible_user_dir }}/.face"
state: link
force: true
when: desktop_avatar_url is not defined or desktop_avatar_url | length == 0
- name: Fail if no local avatar file found and no URL provided
fail:
msg: "No avatar found for '{{ ansible_user_id }}' in {{ desktop_avatar_dir | default(ansible_user_dir ~ '/Pictures/Avatars') }}. Expected one of: {{ ansible_user_id }}.jpg, {{ ansible_user_id }}.jpeg, {{ ansible_user_id }}.png, {{ ansible_user_id }}.webp"
when:
- desktop_avatar_url is not defined or desktop_avatar_url | length == 0
- desktop_avatar_file_detected | length == 0
- name: Check current MATE window manager
command: dconf read /org/mate/desktop/session/required-components/windowmanager
register: mate_wm
changed_when: false
- name: Ensure MATE uses i3 as window manager
become: false
command:
dconf write /org/mate/desktop/session/required-components/windowmanager "'i3'"
when: mate_wm.stdout.strip() != "'i3'"
- name: Add Google Linux signing key (Fedora)
ansible.builtin.rpm_key:
state: present
key: https://dl.google.com/linux/linux_signing_key.pub
become: true
when: ansible_distribution == "Fedora"
- name: Add Google Chrome repository (Fedora)
ansible.builtin.yum_repository:
name: google-chrome
description: Google Chrome - x86_64
baseurl: https://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled: true
gpgcheck: true
gpgkey: https://dl.google.com/linux/linux_signing_key.pub
become: true
when: ansible_distribution == "Fedora"
- name: Install Google Chrome (Fedora)
ansible.builtin.dnf:
name: google-chrome-stable
state: present
update_cache: true
become: true
when: ansible_distribution == "Fedora"