Change i3 to be a shared playbook. Group more playbooks in blocks.
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
---
|
||||
# 20260716 - Hyperling
|
||||
# Add the setup for a simple i3 configuration. It´s pretty easy to use and
|
||||
# functions super well. Very easy to get going and does not need a whole lot of
|
||||
# work to change things around. Good alternative to DWM and so lightweight that
|
||||
# it doesn´t even matter if both are installed!!
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Facts 01
|
||||
set_fact:
|
||||
i3_config: "settings/i3.config"
|
||||
i3_config_dir: "{{ user_user.home }}/.config/i3"
|
||||
i3_package: i3
|
||||
i3_light: light
|
||||
i3_files: thunar
|
||||
i3_term01: alacritty
|
||||
i3_term02: kitty
|
||||
i3_theming: lxappearance
|
||||
i3_theme01: greybird-gtk-theme
|
||||
i3_theme02: arc-theme
|
||||
i3_theme03: numix-gtk-theme
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Facts 02
|
||||
set_fact:
|
||||
i3_config_file: "{{ i3_config_dir }}/config"
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Facts | non-apt
|
||||
set_fact:
|
||||
i3_theme01: htop
|
||||
i3_theme02: htop
|
||||
i3_theme03: htop
|
||||
when: ansible_pkg_mgr != "apt"
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Facts | yay
|
||||
set_fact:
|
||||
i3_yay_packages:
|
||||
- greybird-gtk-theme
|
||||
#- enlightenment-arc-theme
|
||||
- numix-gtk-theme
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
|
||||
#- name: Workstation | Shared | Software | i3 | i3 | Facts | TBD
|
||||
# set_fact:
|
||||
# i3_package: i3-wm
|
||||
# when: ansible_distribution in ("TBD")
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Install
|
||||
package:
|
||||
name:
|
||||
- "{{ i3_package }}"
|
||||
- "{{ lightdm }}"
|
||||
- "{{ i3_light }}"
|
||||
- "{{ i3_files }}"
|
||||
- "{{ i3_term01 }}"
|
||||
- "{{ i3_term02 }}"
|
||||
- "{{ i3_theming }}"
|
||||
- "{{ i3_theme01 }}"
|
||||
- "{{ i3_theme02 }}"
|
||||
- "{{ i3_theme03 }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Install (yay)
|
||||
shell: "yay -Qs {{ item }} || yay --noconfirm -S {{ item }}"
|
||||
loop: "{{ i3_yay_packages }}"
|
||||
when: ansible_pkg_mgr == "pacman"
|
||||
become_user: "{{ aur_user }}"
|
||||
ignore_errors: true
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Config | Create Dir
|
||||
ansible.builtin.file:
|
||||
path: "{{ i3_config_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: "{{ user }}"
|
||||
group: "{{ user }}"
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Config | Copy File
|
||||
copy:
|
||||
src: "{{ i3_config }}"
|
||||
dest: "{{ i3_config_file }}"
|
||||
owner: "{{ user }}"
|
||||
group: "{{ user }}"
|
||||
mode: '0664'
|
||||
|
||||
# TBD: Automate getting the brightness keys to work.
|
||||
#
|
||||
# User is already part of the video group. Just need to configure udev rules.
|
||||
#
|
||||
# Get the folder name from here: `ls /sys/class/backlight/`
|
||||
#
|
||||
# That is your <DEVICE> for the following lines, which go here: /etc/udev/rules.d/backlight.rules
|
||||
# ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="<DEVICE>", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
|
||||
# ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="<DEVICE>", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
|
||||
#
|
||||
# So, for example:
|
||||
# [18:12:20 root@device ~]# cat /etc/udev/rules.d/backlight.rules
|
||||
# ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
|
||||
# ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
|
||||
# [18:12:21 root@device ~]#
|
||||
#
|
||||
# It then required a reboot. Doing the commands below was not enough.
|
||||
#
|
||||
# # sudo udevadm control --reload-rules
|
||||
# # sudo udevadm trigger
|
||||
#
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Light (Linux Only)
|
||||
block:
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Light | Check Backlights
|
||||
ansible.builtin.find:
|
||||
paths: /sys/class/backlight
|
||||
file_type: any # Options: file, directory, any
|
||||
patterns: "*" # Wildcard patterns (e.g., "*.log")
|
||||
recurse: no # Set to 'yes' for subdirectories
|
||||
register: i3_light_device_check
|
||||
ignore_errors: yes
|
||||
|
||||
#- name: Display var _ DELETEME
|
||||
# ansible.builtin.debug:
|
||||
# msg: "{{ i3_light_device_check }}"
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Light | Pull Backlight Name
|
||||
set_fact:
|
||||
i3_light_device_name: "{{ i3_light_device_check.files[0].path | basename }}"
|
||||
ignore_errors: yes
|
||||
|
||||
#- name: Display var - DELETEME
|
||||
# ansible.builtin.debug:
|
||||
# msg: "{{ i3_light_device_name }}"
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Light | udev Rules | Create
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/udev/rules.d/backlight.rules
|
||||
content: |
|
||||
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="{{ i3_light_device_name }}", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
|
||||
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="{{ i3_light_device_name }}", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Workstation | Shared | Software | i3 | i3 | Light | udev Rules | Reload
|
||||
command: "{{ item }}"
|
||||
loop:
|
||||
- udevadm control --reload-rules
|
||||
- udevadm trigger
|
||||
|
||||
when: ansible_system == "Linux"
|
||||
|
||||
#- name: FAIL - DELETEME
|
||||
# meta: end_play
|
||||
Reference in New Issue
Block a user