Refactoring Draft

This commit is contained in:
Kevin Veen-Birkenbach 2022-08-19 21:39:23 +02:00
parent 83b62a8510
commit a209f193e2
55 changed files with 128 additions and 134 deletions

View File

@ -14,85 +14,7 @@ ansible-galaxy collection install -r requirements.yml
- add native-graphic-designer - add native-graphic-designer
- add native-developer-basic - add native-developer-basic
- add native-workspaces - add native-workspaces
- add shell-extension-manager
# 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
```
# See # See
- https://www.middlewareinventory.com/blog/run-ansible-playbook-locally/ - https://www.middlewareinventory.com/blog/run-ansible-playbook-locally/

View File

@ -3,10 +3,14 @@
become: true become: true
roles: roles:
- native-pacman-update - native-pacman-update
- native-general
- native-administrator - native-administrator
- native-caffeine - native-caffeine
- native-non-free-drivers - native-non-free-drivers
- name: native-collection-office
hosts: collection_officetools_hosts
become: true
roles:
- native-collection-office
- name: GNOME setup - name: GNOME setup
hosts: gnome_hosts hosts: gnome_hosts
become: true become: true

View File

@ -0,0 +1,3 @@
dependencies:
- native-aur-helper
- system-gnome

View 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

View File

@ -0,0 +1,5 @@
- name: install java
community.general.pacman:
name:
- jdk11-openjdk
state: present

View 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"
```

View File

@ -0,0 +1,2 @@
dependencies:
- collection-administrator-tools-base

View File

@ -0,0 +1,7 @@
- name: install administrator network analyze tools
community.general.pacman:
name:
- traceroute
- wireshark-qt
- wireshark-cli
state: present

View File

@ -0,0 +1,2 @@
dependencies:
- collection-developer-tools-base

View 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

View File

@ -0,0 +1,2 @@
dependencies:
- collection-administrator-tools-base

View File

@ -0,0 +1,5 @@
- name: install base developer tools
community.general.pacman:
name:
- code
state: present

View File

@ -0,0 +1,2 @@
dependencies:
- collection-developer-tools-base

View File

@ -0,0 +1,5 @@
- name: install bash developer tools
community.general.pacman:
name:
- shellcheck
state: present

View File

@ -0,0 +1,2 @@
dependencies:
- application-java

View File

@ -0,0 +1,2 @@
dependencies:
- collection-developer-tools-base

View File

@ -0,0 +1,5 @@
- name: install php developer tools
community.general.pacman:
name:
- php
state: present

View File

@ -0,0 +1,2 @@
dependencies:
- collection-developer-tools-base

View File

@ -0,0 +1,5 @@
- name: install python developer tools
community.general.pacman:
name:
- python
state: present

View File

@ -0,0 +1,2 @@
dependencies:
- native-libreoffice

View File

@ -0,0 +1,6 @@
- name: install shutter
community.general.pacman:
name:
- chromium
- shutter
state: present

View File

@ -0,0 +1,7 @@
- name: install security tools
community.general.pacman:
name:
- ecryptfs-utils
- encfs
- keepassxc
state: present

View File

@ -1,6 +0,0 @@
- name: Install docker
community.general.pacman:
name:
- docker
- docker-compose
state: present

View File

@ -1,43 +1,17 @@
- name: install general software - name: install general software
community.general.pacman: community.general.pacman:
name: name:
# programing language interpreters
#- jdk11-openjdk
#- python
#- php
# description language interpreters # description language interpreters
#- texlive-most #- texlive-most
# compression tools # compression tools
#- p7zip #- p7zip
# network analyze tools
#- traceroute
#- wireshark-qt
#- wireshark-cli
# security tools
#- ecryptfs-utils
#- encfs
#- keepassxc
# browsers
- chromium
# video/picture manipulation # video/picture manipulation
#- gimp #- gimp
#- blender #- blender
#- obs-studio #- obs-studio
# code quality tools
#- shellcheck
# ide's
#- atom
#- arduino
#- arduino-docs
# virtualization tools # virtualization tools
#- qemu #- qemu
state: present state: present

View File

@ -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

View File

@ -1,2 +0,0 @@
dependencies:
- native-aur-helper

View File

@ -1,5 +0,0 @@
- name: Install caffeine
kewlfft.aur.aur:
use: yay
name:
- caffeine-ng

View 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