ansible-desktop/playbooks/deploy.yml
2025-03-13 19:45:00 +02:00

139 lines
3.8 KiB
YAML

---
- name: Deploy workstation
hosts: localhost
connection: local
become: true
become_method: ansible.builtin.sudo
vars_files:
- ../vars/defaults.yml
roles:
- cups
- firefox
- git
- google_chrome
- kerberos
- ldap
- lm_sensors
- lynx
- mutt
- rpmfusion_nonfree_repo
- signal
- spotify
- ssh_known_hosts
- thinlinc
- thunderbird
tasks:
- name: Check hostname
ansible.builtin.command:
argv:
- hostnamectl
- hostname
- --static
register: hostname_check
changed_when: false
- name: Set random hostname
ansible.builtin.command:
argv:
- hostnamectl
- hostname
- --static
- >-
{{
lookup(
'password',
'/dev/null chars=ascii_lowercase,digits length=4'
)
}}
register: result
changed_when: result.rc == 0
when: not hostname_check.stdout
- name: Remove unneeded packages
ansible.builtin.package:
name: "{{ item }}"
state: absent
with_items:
- abrt
- mlocate
- nano-default-editor
- name: Install development tools
ansible.builtin.dnf:
name:
- "@c-development"
- "@development-tools"
state: installed
- name: Install extra packages
ansible.builtin.package:
name: "{{ item }}"
state: installed
with_items:
- brasero # cd/dvd writing
- cheese # webcam support
- emacs # more editors
- gimp # image editor
- gstreamer1-plugin-openh264 # h264 plugin for browser
- libvirt-client # virsh client tools
- nmap # networking tools
- nwipe # dban like disk erase
- podman-docker # add docker compatibility
- python3-ansible-lint # linter for ansible
- python3-pip # python package manager
- ShellCheck # check shell scripts for errors
- steam # for gaming
- strace # program debugging
- sysstat # iostat etc...
- telegram-desktop # telegram client
- telnet # connection testing
- vim # better vi
- virt-manager # manage virtual machines
- yamllint # linter for yaml files
- name: Check for NVIDIA GPU
ansible.builtin.shell:
cmd: |
set -o pipefail
lspci -d '0x10de:' -n | grep -E '^[0-9]+:[0-9]+\.[0-9]+ 0300:'
register: nvidia_check
failed_when: false
check_mode: false
changed_when: false
- name: Install NVIDIA GPU drivers
ansible.builtin.include_role:
name: nvidia_driver
when: nvidia_check.rc == 0
- name: Disable ksshaskpass
ansible.builtin.copy:
dest: "/etc/profile.d/zz_sshaskpass.{{ item }}"
content: "unset SSH_ASKPASS\n"
mode: "0644"
owner: root
group: "{{ ansible_wheel }}"
with_items:
- csh
- sh
- name: Hide GRUB menu during boot
ansible.builtin.lineinfile:
path: /etc/default/grub
line: GRUB_TIMEOUT_STYLE=hidden
regexp: "^GRUB_TIMEOUT_STYLE=.*"
notify: reconfigure grub
handlers:
- name: Reconfigure GRUB
ansible.builtin.command:
argv:
- grub2-mkconfig
- -o
- /boot/grub2/grub.cfg
register: result
changed_when: result.rc == 0