-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrpm_linux_setup.yml
More file actions
141 lines (120 loc) · 5.58 KB
/
rpm_linux_setup.yml
File metadata and controls
141 lines (120 loc) · 5.58 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
- name: RPM based Machine setup
hosts: localhost
connection: local
gather_facts: true
tasks:
- name: Include vars of global_vars.yml file.
include_vars:
file: global_vars.yml
- name: Get my user
ansible.builtin.set_fact:
remote_regular_user: "{{ ansible_user_id }}"
- name: Show who you are
ansible.builtin.debug:
msg: "Hello {{ remote_regular_user }}!"
- name: Show linux distro
ansible.builtin.debug:
msg: "Hello {{ ansible_facts['distribution'] }}!"
# Clone zsh-autosuggestion repo into local zsh plugin directory for use
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- name: Install zsh plugins
ansible.builtin.git:
repo: "https://github.com/zsh-users/{{ item }}.git"
dest: "{{ ansible_env.HOME }}/.oh-my-zsh/custom/plugins/{{ item }}"
clone: yes
with_items: "{{ zsh_plugins }}"
- name: Tasks that needs to be done as root
become: true
block:
- name: Replace GRUB_DEFAULT line in /etc/default/grub.
lineinfile:
path: /etc/default/grub
regexp: '^GRUB_DEFAULT='
line: 'GRUB_DEFAULT=saved'
- name: Edit grub to remember last choice of grub OS boot menu.
blockinfile:
path: /etc/default/grub
block: |
# Remember last choice of OS boot functionality
GRUB_SAVEDEFAULT=true
insertafter: EOF
- name: Update Grub configuration for Fedora.
command: grub2-mkconfig -o /boot/grub2/grub.cfg
- name: Set bluetooth idle timeout to 15 minutes. https://askubuntu.com/questions/1264725/how-to-disable-bluetooth-power-saving
lineinfile:
path: /etc/bluetooth/input.conf
regexp: '^#IdleTimeout=30'
line: 'IdleTimeout=15'
- name: Update bluetooth service configuration.
command: systemctl restart bluetooth.service
- name: Edit dnf config to make it faster.
blockinfile:
path: /etc/dnf/dnf.conf
block: |
fastestmirror=True
max_parallel_downloads=10
keepcache=True
insertafter: EOF
- name: Add the Brave Browser repository
ansible.builtin.yum_repository:
name: brave-browser
description: Brave Browser YUM repo
baseurl: https://brave-browser-rpm-release.s3.brave.com/x86_64/
gpgkey: https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
enabled: yes
gpgcheck: yes
state: present
- name: Install personalised fedora dnf packages.
ansible.builtin.dnf:
state: present
name: "{{ packages }}"
update_cache: true
cache_valid_time: 86400
ignore_errors: true
- name: Install personalised flatpak packages. (Will fail if you are on ubuntu and do not have flatpak manager installed.)
community.general.flatpak:
state: present
method: system
name: "{{ flatpaks }}"
ignore_errors: true
- name: Download vscode directly from source for fedora.
ansible.builtin.get_url:
url: "https://code.visualstudio.com/sha/download?build=stable&os=linux-rpm-x64"
dest: "/tmp/{{ vscode_rpm }}"
- name: Install downloaded vscode.
ansible.builtin.package:
state: present
name: "/tmp/{{ vscode_rpm }}"
disable_gpg_check: "{{ value_for_gpg | d(omit) }}"
- name: Install needed pipx packages.
community.general.pipx:
state: present
name: "{{ item }}"
with_items: "{{ pipx_packages }}"
ignore_errors: true
- name: Replace line in brave-browser.desktop file to enable 2 fingers swipe back and forth gesture. https://gist.github.com/detherminal/1845c794ee3f3cdcc4e7eb713e9ee6fd
lineinfile:
path: /usr/share/applications/brave-browser.desktop
regexp: '^Exec=/usr/bin/brave-browser-stable %U$'
line: 'Exec=/usr/bin/brave-browser-stable %U --ozone-platform=wayland --enable-features=TouchpadOverscrollHistoryNavigation'
- name: Check if earlyoom config file exists
ansible.builtin.stat:
path: /etc/default/earlyoom
register: earlyoom_stat
- name: Update EARLYOOM_ARGS in /etc/default/earlyoom customized for vscode 61696 crash https://github.com/rfjakob/earlyoom/issues/240
ansible.builtin.lineinfile:
path: /etc/default/earlyoom
regexp: '^EARLYOOM_ARGS='
line: 'EARLYOOM_ARGS="-r 0 -m 4 -M 409600 --prefer ''^Web Content$'' --avoid ''^(apt|code|packagekitd|gnome-shell|gnome-session-c|gnome-session-b|lightdm|sddm|sddm-helper|gdm|gdm-wayland-ses|gdm-session-wor|gdm-x-session|Xorg|Xwayland|systemd|systemd-logind|dbus-daemon|dbus-broker|cinnamon|cinnamon-session|kwin_x11|kwin_wayland|plasmashell|ksmserver|plasma_session|startplasma-way|xfce4-session|mate-session|marco|lxqt-session|openbox)$'''
state: present
backup: yes
when: earlyoom_stat.stat.exists
notify: Restart earlyoom
handlers:
- name: Restart earlyoom
ansible.builtin.service:
name: earlyoom
state: restarted
when: earlyoom_stat.stat.exists
become: true