Commit 6275ea67db03

Vincent Demeester <vincent@sbr.pm>
2019-05-12 19:26:13
Initial playbook…
… and start a bootstrap script, that would work on all supported operating system. Goal being : log-in, curl that script, execute and it's on !
1 parent 3dd9b2d
playbook/post_install.retry
@@ -0,0 +1,1 @@
+localhost
playbook/post_install.yaml
@@ -0,0 +1,84 @@
+# TODO: create a bootstrap script (fedora, nixos support)
+# TODO: tlp, tlp-rdw (+ systemd enabled) – https://www.fosslinux.com/2304/how-to-increase-laptops-battery-life-in-fedora-all-versions.htm
+# TODO: powertop (+ systemd enabled)
+# TODO: rpm-fusion + stuff – https://rpmfusion.org/Configuration
+# TODO: Install nix + home-manager — install commands from README (as user)
+# TODO: gedit configuration
+# TODO: syncthing + syncthing-gtk + service(s)
+# TODO: wireguard — https://github.com/mina-alber/wireguard-ansible
+# TODO: fonts (fira-code, hasklig, … ?) – https://github.com/tonsky/FiraCode/wiki/Linux-instructions#fedora
+# TODO: yubico
+# TODO: fingerprint (hokkaido)
+# TODO: compose key (capslock)
+- hosts: localhost
+  tasks:
+    - name: Install essentials
+      become: yes
+      package: name={{item}} state=present
+      with_items:
+        - vim
+        - htop
+        - tmux
+        - python3-psutil
+        - dconf-editor
+        - redhat-text-fonts
+        - redhat-display-fonts
+        - mozilla-fira-mono-fonts
+        - mozilla-fira-sans-fonts
+        - acpi
+    - name: Enable Night Light
+      dconf:
+        key: "/org/gnome/settings-daemon/plugins/color/night-light-enabled"
+        value: "true"
+        state: present
+    - name: Enable Night Light
+      dconf:
+        key: "/org/gnome/settings-daemon/plugins/color/night-light-schedule-automatic"
+        value: "true"
+        state: present
+    - name: Enable Night Light
+      dconf:
+        key: "/org/gnome/settings-daemon/plugins/color/night-light-temperature"
+        value: "5000"
+        state: present
+    - name: Install dev
+      become: yes
+      package: name={{item}} state=present
+      with_items:
+        - emacs
+        - golang
+        - make
+        - automake
+        - gcc
+        - gcc-c++
+    - name: Install media
+      become: yes
+      package: name={{item}} state=present
+      with_items:
+        - mpv
+    - name: Install containers stuff
+      become: yes
+      package: name={{item}} state=present
+      with_items:
+        - origin-clients
+        - podman
+        - buildah
+        - skopeo
+    - name: Install syncthing
+      become: yes
+      package: name={{item}} state=present
+      with_items:
+        - syncthing
+        - syncthing-gtk
+    - name: Install virtualization packages
+      become: yes
+      package: name={{item}} state=present
+      with_items:
+        - virt-manager
+        - qemu-kvm
+        - qemu-img
+        - virt-install
+        - bridge-utils
+        - libvirt
+        - libvirt-devel
+        - libvirt-daemon-kvm
bootstrap.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+# This scripts aims to detect which system is running, and bootstrap
+# the home configuration accordingly. So far the current setup are
+# supported:
+# - NixOS (>= 19.03 more or less)
+# - Fedora (>= 30)
+# - Mac OS X (>= 10.14)
+
+set -e
+
+setup_nixos() {
+    echo "NixOS detected"
+}
+
+setup_fedora() {
+    echo "Fedora detected"
+}
+		
+setup_osx() {
+    echo "Mac OS X detected"
+    if [[ "$kernel_name" == "Darwin" ]]; then
+        IFS=$'\n' read -d "" -ra sw_vers < <(awk -F'<|>' '/key|string/ {print $3}' \
+                            "/System/Library/CoreServices/SystemVersion.plist")
+        for ((i=0;i<${#sw_vers[@]};i+=2)) {
+		case ${sw_vers[i]} in
+                    ProductName)          darwin_name=${sw_vers[i+1]} ;;
+                    ProductVersion)       osx_version=${sw_vers[i+1]} ;;
+                    ProductBuildVersion)  osx_build=${sw_vers[i+1]}   ;;
+		esac
+            }
+     fi
+}
+
+IFS=" " read -ra uname <<< "$(uname -srm)"
+kernel_name="${uname[0]}"
+kernel_version="${uname[1]}"
+kernel_machine="${uname[2]}"
+
+case "$kernel_name" in
+    "Linux" | "GNU")
+	if [[ -f "/etc/os-release" || -f "/usr/lib/os-release" ]]; then
+                files=("/etc/os-release" "/usr/lib/os-release")
+
+                # Source the os-release file
+                for file in "${files[@]}"; do
+                    source "$file" && break
+                done
+		case "$ID" in
+		    "nixos")
+			setup_nixos ;;
+		    "fedora")
+			setup_fedora ;;
+		esac
+	fi ;;
+    "Darwin")
+	setup_osx ;;
+esac