1
0
mirror of https://github.com/gjkcz/ansible-void.git synced 2024-11-30 03:08:52 +01:00
ansible-void/setup.yaml

291 lines
6.3 KiB
YAML
Raw Normal View History

2023-04-29 19:51:14 +02:00
---
- name: SSH
hosts: all
2023-06-08 11:27:16 +02:00
tags: ssh
2023-04-29 19:51:14 +02:00
tasks:
- name: Ensure root ssh directory exists
file:
path: /root/.ssh
state: directory
- name: Import SSH keys
authorized_key:
user: root
key: '{{ item }}'
state: present
loop: '{{ ssh_keys }}'
- name: General
hosts: all
2023-06-08 11:27:16 +02:00
tags: general
2023-04-29 19:51:14 +02:00
tasks:
2023-05-01 18:18:57 +02:00
- name: Install services
2023-04-29 19:51:14 +02:00
community.general.xbps:
name:
- avahi
- chrony
state: present
2023-05-01 18:18:57 +02:00
- name: Enable services
2023-04-29 19:51:14 +02:00
community.general.runit:
2023-05-01 18:18:57 +02:00
name: '{{ item }}'
2023-04-29 19:51:14 +02:00
enabled: true
state: started
2023-05-01 18:18:57 +02:00
loop:
- avahi-daemon
- chronyd
2023-04-29 19:51:14 +02:00
2023-05-01 18:18:57 +02:00
- name: Disable unneeded services
2023-04-29 19:51:14 +02:00
community.general.runit:
name: '{{ item }}'
enabled: false
state: stopped
loop:
2023-05-01 18:18:57 +02:00
- wpa_supplicant
2023-04-29 19:51:14 +02:00
- name: Users
hosts: all
2023-06-08 11:27:16 +02:00
tags: users
2023-04-29 19:51:14 +02:00
tasks:
- name: Set bash as default shell for root
user:
name: root
shell: /bin/bash
- name: User student
user:
name: student
password: $6$7Z.h8Q6CO9AevdIp$8W2nuvD7ZqeXBO.Azsayx2tJ4L0KD44hOz5aNzpGPN/hUtaROvmY7aJ0x7Ie3CPawp6lV4ln2fHQQ7V5Yuy7k0
groups:
# Arduino serial access
- dialout
state: present
- name: Lock bash configuration files for student
# Can be removed after LDAP setup
file:
path: '{{ item }}'
owner: root
group: root
2023-06-08 11:32:12 +02:00
mode: 0644
2023-04-29 19:51:14 +02:00
state: touch
loop:
- /home/student/.bashrc
- /home/student/.bash_profile
- name: Disable SSH for user student
ansible.builtin.lineinfile:
path: "/etc/ssh/sshd_config"
line: "DenyUsers student"
create: true
- name: Software
hosts: all
2023-06-08 11:27:16 +02:00
tags: software
2023-04-29 19:51:14 +02:00
tasks:
- name: Add non-free repository
community.general.xbps:
name: void-repo-nonfree
state: present
- name: Upgrade all packages
community.general.xbps:
upgrade: true
- name: Install common packages
2023-04-29 19:51:14 +02:00
community.general.xbps:
name: '{{ xbps_install }}'
state: present
when: xbps_install
- name: Install video drivers
community.general.xbps:
name:
- mesa-dri
- vulkan-loader
- mesa-vulkan-radeon
- amdvlk
- xf86-video-amdgpu
- mesa-vaapi
- mesa-vdpau
- intel-video-accel
- mesa-vulkan-intel
2023-04-29 19:51:14 +02:00
- name: Recursively remove packages
community.general.xbps:
name: '{{ xbps_remove }}'
state: absent
recurse: true
when: xbps_remove
2023-06-09 10:55:55 +02:00
- name: Clear xbps cache
command: 'xbps-remove -O'
- name: Purge old kernels
command: 'vkpurge rm all'
2023-04-29 19:51:14 +02:00
- name: Gnome
hosts: all
2023-06-08 11:27:16 +02:00
tags:
- gnome
- software
2023-04-29 19:51:14 +02:00
handlers:
- name: Update dconf database
command: 'dconf update'
tasks:
- name: Install Gnome
community.general.xbps:
name:
- dbus
- gnome
- gdm
- xorg # Prevents a crash on some systems
- mesa-vdpau
- mesa-vaapi
- pipewire
state: present
- name: Enable services
community.general.runit:
name: '{{ item }}'
enabled: true
state: started
loop:
- dbus
- gdm
2023-11-01 15:41:14 +01:00
- name: Copy session cleanup script
copy:
src: 'files/session-cleanup.sh'
dest: '/etc/gdm/PostSession/Default'
mode: '0755'
2023-04-29 19:51:14 +02:00
- name: Enable autologin
copy:
src: 'files/desktop/autologin'
dest: '/etc/gdm/custom.conf'
notify: Update dconf database
- name: Ensure directories exist
file:
path: '{{item}}'
state: directory
loop:
- /etc/dconf/db/local.d
- /etc/dconf/db/local.d/locks
- name: Create user profile
copy:
src: 'files/desktop/profile/user'
dest: '/etc/dconf/profile/user'
- name: Copy configuration files
copy:
src: 'files/desktop/main'
dest: '/etc/dconf/db/local.d/main'
notify: Update dconf database
- name: Set screen timeout
template:
src: 'files/desktop/screensaver'
dest: '/etc/dconf/db/local.d/screensaver'
notify: Update dconf database
2023-05-01 18:15:29 +02:00
- name: PipeWire
hosts: all
2023-06-08 11:27:16 +02:00
tags: pipewire
2023-05-01 18:15:29 +02:00
tasks:
- name: Install PipeWire
community.general.xbps:
name:
- pipewire
- wireplumber
state: present
- name: Ensure configuration directories exist
file:
path: '/etc/pipewire/pipewire.conf.d/'
state: directory
- name: Copy PipeWire configuration
copy:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
loop:
- src: 'files/pipewire/pipewire.conf'
dest: '/etc/pipewire/pipewire.conf'
- src: 'files/pipewire/10-wireplumber.conf'
dest: '/etc/pipewire/pipewire.conf.d/10-wireplumber.conf'
- name: Symlink PipeWire to autostart
file:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
state: link
loop:
- src: '/usr/share/applications/pipewire.desktop'
dest: '/etc/xdg/autostart/pipewire.desktop'
- src: '/usr/share/applications/pipewire-pulse.desktop'
dest: '/etc/xdg/autostart/pipewire-pulse.desktop'
2023-04-29 19:51:14 +02:00
- name: GRUB
hosts: all
2023-06-08 11:27:16 +02:00
tags: grub
2023-04-29 19:51:14 +02:00
handlers:
- name: grub-mkconfig
command: 'grub-mkconfig -o /boot/grub/grub.cfg'
tasks:
- name: Copy GRUB configuration
template:
src: 'files/grub/grub'
dest: '/etc/default/grub'
notify: grub-mkconfig
- name: Firefox
hosts: all
tasks:
- name: Ensure Firefox extensions folder exists
file:
path: "/usr/lib64/firefox/distribution/extensions"
state: directory
- name: Install firefox extensions
copy:
src: "{{ item }}"
dest: "/usr/lib64/firefox/distribution/extensions/"
loop:
- "files/firefox/uBlock0@raymondhill.net.xpi"
- name: Bakaláři
hosts: teachers
2023-06-08 11:27:16 +02:00
tags: bakalari
2023-04-29 19:51:14 +02:00
tasks:
- name: Create a desktop shortcut for Bakaláři
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- src: "files/bakalari/bakalari.desktop"
dest: "/usr/share/applications/bakalari.desktop"
- src: "files/bakalari/bakalari.png"
dest: "/usr/share/icons/bakalari.png"