Created
August 12, 2025 10:39
-
-
Save MParvin/8ca56c2837207d724840d9977e045634 to your computer and use it in GitHub Desktop.
Ansible playbook to install Gnome on Freebsd 14.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Install and configure GNOME desktop on FreeBSD 14.3 | |
hosts: freebsd | |
become: yes | |
vars: | |
desktop_user: {{ ansible_user }} | |
video_driver: i915kms # Options: i915kms, amdgpu, radeonkms, nvidia-modeset | |
wayland_enabled: false | |
tasks: | |
- name: Update pkg repositories | |
ansible.builtin.shell: pkg update -f | |
args: | |
warn: false | |
- name: Install Xorg | |
ansible.builtin.pkgng: | |
name: xorg | |
state: present | |
- name: Install GNOME and GDM | |
ansible.builtin.pkgng: | |
name: | |
- gnome | |
- gdm | |
state: present | |
- name: Install drm-kmod for graphics drivers | |
ansible.builtin.pkgng: | |
name: drm-kmod | |
state: present | |
- name: Enable graphics kernel module in rc.conf | |
ansible.builtin.lineinfile: | |
path: /etc/rc.conf | |
regexp: '^kld_list=' | |
line: "kld_list=\"{{ video_driver }}\"" | |
create: yes | |
- name: Enable GNOME required services | |
ansible.builtin.sysrc: | |
name: "{{ item }}" | |
value: "YES" | |
loop: | |
- dbus_enable | |
- gdm_enable | |
- hald_enable | |
- name: Add desktop user to video group | |
ansible.builtin.user: | |
name: "{{ desktop_user }}" | |
groups: video | |
append: yes | |
- name: Fix home directory ownership | |
ansible.builtin.file: | |
path: "/home/{{ desktop_user }}" | |
owner: "{{ desktop_user }}" | |
group: "{{ desktop_user }}" | |
recurse: yes | |
- name: Configure GDM to force Xorg if Wayland is disabled | |
ansible.builtin.blockinfile: | |
path: /usr/local/etc/gdm/custom.conf | |
block: | | |
[daemon] | |
WaylandEnable={{ 'true' if wayland_enabled else 'false' }} | |
create: yes | |
- name: Create .xinitrc for manual startx fallback | |
ansible.builtin.copy: | |
dest: "/home/{{ desktop_user }}/.xinitrc" | |
content: "exec gnome-session\n" | |
owner: "{{ desktop_user }}" | |
group: "{{ desktop_user }}" | |
mode: '0755' | |
- name: Reboot the system | |
ansible.builtin.reboot: | |
reboot_timeout: 300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment