mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Refactoring Draft
This commit is contained in:
		
							
								
								
									
										80
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								README.md
									
									
									
									
									
								
							| @@ -14,85 +14,7 @@ ansible-galaxy collection install -r requirements.yml | ||||
| - add native-graphic-designer | ||||
| - add native-developer-basic | ||||
| - add native-workspaces | ||||
|  | ||||
| # Refactor | ||||
| ```bash | ||||
| info "Setup, configuration and installation of dependencies for installed software..." | ||||
|  | ||||
| if pacman -Qi "arduino" > /dev/null ; then | ||||
| 	info "Configurate system for arduino..." && | ||||
| 	sudo usermod -a -G uucp "$USER" && | ||||
| 	sudo usermod -a -G lock "$USER" || error "Couldn't add \"$USER\" to the relevant groups." | ||||
| fi | ||||
|  | ||||
| if pacman -Qi "docker" > /dev/null ; then | ||||
| 	info "Setting up docker..." && | ||||
| 	info "Add current user \"$USER\" to user group docker..." && | ||||
| 	sudo usermod -a -G docker "$USER" || error "Failed to add user." | ||||
| 	info "Restarting docker service..." && | ||||
| 	sudo systemctl restart docker && | ||||
| 	info "Disable and stop docker service..." && | ||||
| 	sudo systemctl disable --now docker || error "\"systemctl\" produced an error." | ||||
| 	info "For performance reasons docker is not enabled. Start docker by executing \"sudo systemctl restart docker\" when you need it." | ||||
| fi | ||||
|  | ||||
| if [ ! "$(pacman -Qi "virtualbox")" ] ; then | ||||
| 	info "Setting up virtualbox..." && | ||||
| 	sudo pacman -S virtualbox "$(pacman -Qsq "^linux" | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-virtualbox-host-modules"}' ORS=' ')" && | ||||
| 	sudo vboxreload && | ||||
| 	pamac build virtualbox-ext-oracle && | ||||
| 	sudo gpasswd -a "$USER" vboxusers || error | ||||
| 	info "Keep in mind to install the guest additions in the virtualized system. See https://wiki.manjaro.org/index.php?title=VirtualBox" | ||||
| fi | ||||
|  | ||||
| install_gnome_extension(){ | ||||
| 	info "Install GNOME extension \"$1\"..." | ||||
| 	extension_folder="$HOME/.local/share/gnome-shell/extensions/$1/" | ||||
| 	if [ -d "$extension_folder" ]; | ||||
| 		then | ||||
| 			if [ -d "$extension_folder"".git" ]; | ||||
| 				then | ||||
| 					warning "Found a .git repository didn't expect to find this here." && | ||||
| 					info "Pulling changes from git..." && | ||||
| 					(cd "$extension_folder" && git pull) || error | ||||
| 			else | ||||
| 				info "No git repository. Extension will not be updated." | ||||
| 			fi | ||||
| 		else | ||||
| 			info "Install..." && | ||||
| 			git clone "$2" "$extension_folder" || error | ||||
| 	fi | ||||
|  | ||||
| 	if [ -f "$extension_folder""Makefile" ]; | ||||
| 		then | ||||
|  | ||||
| 			tmp_extension_folder="/tmp/$1" | ||||
| 			mv "$extension_folder" "$tmp_extension_folder" | ||||
| 			info "Compilling extension.." | ||||
| 			(cd "$tmp_extension_folder" && make install) || error "Compilation with failed." | ||||
|  | ||||
| 			info "Cleaning up tmp-extension folder..."&& | ||||
| 			rm -fr "$tmp_extension_folder" || error | ||||
|  | ||||
| 		else | ||||
| 			info "No Makefile found. Skipping compilation..." | ||||
| 	fi | ||||
|  | ||||
| 	info "Activating GNOME extension \"$1\"..." && | ||||
| 	gnome-extensions enable "$1" || error | ||||
| } | ||||
|  | ||||
| if [ "$DESKTOP_SESSION" == "gnome" ]; then | ||||
|   info "Synchronizing gnome tools..." && | ||||
|   install_yay_packages_if_needed "$(get_packages "client/yay/gnome")" || error "Syncronisation failed." | ||||
| 	info "Install GNOME extensions..." && | ||||
| 	install_gnome_extension "nasa_apod@elinvention.ovh" "https://github.com/Elinvention/gnome-shell-extension-nasa-apod.git" | ||||
|   install_gnome_extension "caffeine@patapon.info" "https://github.com/eonpatapon/gnome-shell-extension-caffeine.git" | ||||
| 	info "Deactivating \"Dash to Dock\"..." && | ||||
| 	gnome-extensions disable dash-to-dock@micxgx.gmail.com || error | ||||
|  | ||||
| fi | ||||
| ``` | ||||
| - add shell-extension-manager | ||||
|  | ||||
| # See | ||||
| - https://www.middlewareinventory.com/blog/run-ansible-playbook-locally/ | ||||
|   | ||||
| @@ -3,10 +3,14 @@ | ||||
|   become: true | ||||
|   roles: | ||||
|     - native-pacman-update | ||||
|     - native-general | ||||
|     - native-administrator | ||||
|     - native-caffeine | ||||
|     - native-non-free-drivers | ||||
| - name: native-collection-office | ||||
|   hosts: collection_officetools_hosts | ||||
|   become: true | ||||
|   roles: | ||||
|     - native-collection-office | ||||
| - name: GNOME setup | ||||
|   hosts: gnome_hosts | ||||
|   become: true | ||||
|   | ||||
							
								
								
									
										3
									
								
								roles/application-caffeine/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								roles/application-caffeine/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| dependencies: | ||||
| - native-aur-helper | ||||
| - system-gnome | ||||
							
								
								
									
										11
									
								
								roles/application-docker/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								roles/application-docker/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| - name: install docker | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - docker | ||||
|       - docker-compose | ||||
|     state: present | ||||
|  | ||||
| - name: Adding user {{client_username}} to relevant arduino usergroups   | ||||
|   user: name={{client_username}} | ||||
|         groups=docker | ||||
|         append=yes | ||||
							
								
								
									
										5
									
								
								roles/application-java/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								roles/application-java/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| - name: install java | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - jdk11-openjdk | ||||
|     state: present | ||||
							
								
								
									
										9
									
								
								roles/application-virtual-box/Readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								roles/application-virtual-box/Readme.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| # application-virtual-box | ||||
|  | ||||
| ```bash | ||||
| 	sudo pacman -S virtualbox "$(pacman -Qsq "^linux" | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-virtualbox-host-modules"}' ORS=' ')" && | ||||
| 	sudo vboxreload && | ||||
| 	pamac build virtualbox-ext-oracle && | ||||
| 	sudo gpasswd -a "$USER" vboxusers || exit 1 | ||||
| 	echo "Keep in mind to install the guest additions in the virtualized system. See https://wiki.manjaro.org/index.php?title=VirtualBox" | ||||
| ``` | ||||
| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - collection-administrator-tools-base | ||||
| @@ -0,0 +1,7 @@ | ||||
| - name: install administrator network analyze tools | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - traceroute | ||||
|       - wireshark-qt | ||||
|       - wireshark-cli | ||||
|     state: present | ||||
							
								
								
									
										2
									
								
								roles/collection-developer-tools-arduino/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								roles/collection-developer-tools-arduino/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - collection-developer-tools-base | ||||
							
								
								
									
										11
									
								
								roles/collection-developer-tools-arduino/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								roles/collection-developer-tools-arduino/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| - name: install arduino developer tools | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - arduino | ||||
|       - arduino-docs | ||||
|     state: present | ||||
|  | ||||
| - name: Adding user {{client_username}} to relevant arduino usergroups   | ||||
|   user: name={{client_username}} | ||||
|         groups=uucp lock | ||||
|         append=yes | ||||
							
								
								
									
										2
									
								
								roles/collection-developer-tools-base/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								roles/collection-developer-tools-base/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - collection-administrator-tools-base | ||||
							
								
								
									
										5
									
								
								roles/collection-developer-tools-base/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								roles/collection-developer-tools-base/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| - name: install base developer tools | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - code | ||||
|     state: present | ||||
							
								
								
									
										2
									
								
								roles/collection-developer-tools-bash/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								roles/collection-developer-tools-bash/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - collection-developer-tools-base | ||||
							
								
								
									
										5
									
								
								roles/collection-developer-tools-bash/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								roles/collection-developer-tools-bash/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| - name: install bash developer tools | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - shellcheck | ||||
|     state: present | ||||
							
								
								
									
										2
									
								
								roles/collection-developer-tools-java/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								roles/collection-developer-tools-java/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - application-java | ||||
							
								
								
									
										2
									
								
								roles/collection-developer-tools-php/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								roles/collection-developer-tools-php/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - collection-developer-tools-base | ||||
							
								
								
									
										5
									
								
								roles/collection-developer-tools-php/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								roles/collection-developer-tools-php/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| - name: install php developer tools | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - php  | ||||
|     state: present | ||||
							
								
								
									
										2
									
								
								roles/collection-developer-tools-python/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								roles/collection-developer-tools-python/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - collection-developer-tools-base | ||||
							
								
								
									
										5
									
								
								roles/collection-developer-tools-python/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								roles/collection-developer-tools-python/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| - name: install python developer tools | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - python | ||||
|     state: present | ||||
							
								
								
									
										2
									
								
								roles/collection-office-tools/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								roles/collection-office-tools/meta/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| dependencies: | ||||
| - native-libreoffice | ||||
							
								
								
									
										6
									
								
								roles/collection-office-tools/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								roles/collection-office-tools/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| - name: install shutter | ||||
|   community.general.pacman: | ||||
|     name:  | ||||
|       - chromium | ||||
|       - shutter | ||||
|     state: present | ||||
							
								
								
									
										7
									
								
								roles/collection-security-tools/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								roles/collection-security-tools/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| - name: install security tools | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - ecryptfs-utils | ||||
|       - encfs | ||||
|       - keepassxc | ||||
|     state: present | ||||
| @@ -1,6 +0,0 @@ | ||||
| - name: Install docker | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - docker | ||||
|       - docker-compose | ||||
|     state: present | ||||
| @@ -1,43 +1,17 @@ | ||||
| - name: install general software | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       # programing language interpreters | ||||
|       #- jdk11-openjdk | ||||
|       #- python | ||||
|       #- php | ||||
|  | ||||
|       # description language interpreters | ||||
|       #- texlive-most | ||||
|  | ||||
|       # compression tools | ||||
|       #- p7zip | ||||
|  | ||||
|       # network analyze tools | ||||
|       #- traceroute | ||||
|       #- wireshark-qt | ||||
|       #- wireshark-cli | ||||
|  | ||||
|       # security tools | ||||
|       #- ecryptfs-utils | ||||
|       #- encfs | ||||
|       #- keepassxc | ||||
|  | ||||
|       # browsers | ||||
|       - chromium | ||||
|  | ||||
|       # video/picture manipulation | ||||
|       #- gimp | ||||
|       #- blender | ||||
|       #- obs-studio | ||||
|  | ||||
|       # code quality tools | ||||
|       #- shellcheck | ||||
|  | ||||
|       # ide's | ||||
|       #- atom | ||||
|       #- arduino | ||||
|       #- arduino-docs | ||||
|  | ||||
|       # virtualization tools | ||||
|       #- qemu | ||||
|     state: present | ||||
|   | ||||
| @@ -1,15 +0,0 @@ | ||||
| - name: Install Gnome Software | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - gnome-shell-extensions | ||||
|       - gnome-shell-extension-desktop-icons-ng  | ||||
|       - gnome-terminal | ||||
|     state: present  | ||||
|  | ||||
| - name: GNOME Activate Extensions | ||||
|   ansible.builtin.shell: gsettings set org.gnome.shell disable-user-extensions false | ||||
|   become: false | ||||
|  | ||||
| - name: GNOME Set favorite apps | ||||
|   ansible.builtin.shell: gsettings set org.gnome.shell favorite-apps "{{favorite_apps}}" | ||||
|   become: false | ||||
| @@ -1,2 +0,0 @@ | ||||
| dependencies: | ||||
| - native-aur-helper | ||||
| @@ -1,5 +0,0 @@ | ||||
| - name: Install caffeine | ||||
|   kewlfft.aur.aur: | ||||
|     use: yay | ||||
|     name: | ||||
|       - caffeine-ng | ||||
							
								
								
									
										27
									
								
								roles/system-gnome/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								roles/system-gnome/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| - name: Install Gnome Software | ||||
|   community.general.pacman: | ||||
|     name: | ||||
|       - gnome-shell-extensions | ||||
|       - gnome-shell-extension-desktop-icons-ng  | ||||
|       - gnome-terminal | ||||
|     state: present  | ||||
|  | ||||
| - name: GNOME Activate Extensions | ||||
|   ansible.builtin.shell: gsettings set org.gnome.shell disable-user-extensions false | ||||
|   become: false | ||||
|  | ||||
| - name: GNOME Set favorite apps | ||||
|   ansible.builtin.shell: gsettings set org.gnome.shell favorite-apps "{{favorite_apps}}" | ||||
|   become: false | ||||
|  | ||||
| - name: pull CLI GNOME Extension manager script | ||||
|   git: | ||||
|     repo: "git@github.com:kevinveenbirkenbach/cli-gnome-extension-manager.git" | ||||
|     dest: "$HOME/Repositories/github.com/kevinveenbirkenbach/cli-gnome-extension-manager" | ||||
|     update: yes | ||||
|   become: false | ||||
|  | ||||
| - name: Execute CLI GNOME Extension manager script | ||||
|   ansible.builtin.shell: bash "/home/{{client_username}}/Repositories/github.com/kevinveenbirkenbach/cli-gnome-extension-manager/gnome-extension-manager.sh" "{{ item[0] }}" "{{ item[1] }}" "{{ item[2] }}" | ||||
|   loop: "{{gnome_extensions}}" | ||||
|   become: true | ||||
		Reference in New Issue
	
	Block a user