From 509acd047c98d5814160a2683084b35d8bce4837 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 17 Mar 2022 19:25:13 +0800 Subject: [PATCH] Modularize Fedora playbook Now, it is one step closer into a NixOS-like setup. Apparently, there is a list of directories to be searched to get the various roles which you can configure through ~ansible.cfg~. --- ansible.cfg | 3 + inventory/inventory | 8 + playbooks/fedora-workstation.yml | 96 +++++++++ post-install.yml | 241 ---------------------- {apps => roles/apps}/emacs/tasks/main.yml | 0 5 files changed, 107 insertions(+), 241 deletions(-) create mode 100644 ansible.cfg create mode 100644 inventory/inventory create mode 100644 playbooks/fedora-workstation.yml delete mode 100644 post-install.yml rename {apps => roles/apps}/emacs/tasks/main.yml (100%) diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..7117505 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +inventory = inventory/inventory +roles_path = roles/ diff --git a/inventory/inventory b/inventory/inventory new file mode 100644 index 0000000..39bc71a --- /dev/null +++ b/inventory/inventory @@ -0,0 +1,8 @@ +--- +# vim:set ft=yaml: +workstation: + hosts: + 127.0.0.1: + vars: + ansible_connection: local + diff --git a/playbooks/fedora-workstation.yml b/playbooks/fedora-workstation.yml new file mode 100644 index 0000000..f4580de --- /dev/null +++ b/playbooks/fedora-workstation.yml @@ -0,0 +1,96 @@ +# TODO: +# * Configure GNOME extensions +# * Configure the Fedora host with custom systemd units +# * Custom session variables +--- +- name: foo-dogsquared's Fedora workstation + hosts: workstation + become: yes + + roles: + - role: system/base + tags: + - dev_minimal + - dev_extra + - flatpak_desktop_apps + - i18n + - fonts + - apps/emacs + + tasks: + - name: Install Flatpak development tools + dnf: + state: present + name: + - flatpak + - flatpak-builder + + - name: Enable copr repositories + community.general.copr: + state: enabled + name: "{{ item }}" + loop: + - cappyishihara/opentabletdriver + - atim/lazygit + - fale/gopass + - peterwu/iosevka + + # Package installations. + - name: Install packages from enabled copr repositories + dnf: + state: present + name: + - lazygit + - opentabletdriver + - golang-github-gopasspw-gopass + - iosevka-fonts + - iosevka-curly-fonts + - iosevka-curly-slab-fonts + - iosevka-slab-fonts + - iosevka-etoile-fonts + + - name: Install RPM development tools + dnf: + state: present + name: + - rpm-build + - go-rpm-macros + + - name: Install web-related tools + dnf: + state: present + name: + - thunderbird + - chromium + - firefox + + - name: Install Fedora COPR dev't tools + dnf: + state: present + name: + - copr-cli + - dnf-plugins-core + + - name: Install Ansible + dnf: + state: present + name: + - ansible + - ansible-doc + - ansible-collection-community-general + - python3-psutil + + # Configure desktop environment. + - name: Install dconf keyfiles + copy: + src: ./files/dconf/ + dest: /etc/dconf/db/a-happy-gnome.d + + - name: Set 'user' dconf profile with the custom GNOME config + ansible.builtin.shell: echo "system-db:a-happy-gnome" >> /etc/dconf/profile/user + + - name: Enable night light in GNOME + dconf: + state: present + key: /org/gnome/settings-daemon/plugins/color/night-light-enabled + value: "true" diff --git a/post-install.yml b/post-install.yml deleted file mode 100644 index 6fb975e..0000000 --- a/post-install.yml +++ /dev/null @@ -1,241 +0,0 @@ ---- -- hosts: localhost - become: yes - become_user: root - tasks: - - name: Install Flatpak development tools - dnf: - state: present - name: - - flatpak - - flatpak-builder - - - name: Add Flatpak remotes - flatpak_remote: - state: present - name: "{{ item.name }}" - flatpakrepo_url: "{{ item.repo }}" - loop: - - name: flathub - repo: "https://flathub.org/repo/flathub.flatpakrepo" - - name: flathub-beta - repo: "https://flathub.org/beta-repo/flathub-beta.flatpakrepo" - - name: gnome-nightly - repo: "https://nightly.gnome.org/gnome-nightly.flatpakrepo" - - name: kdeapps - repo: "https://distribute.kde.org/kdeapps.flatpakrepo" - - - name: Enable copr repositories - community.general.copr: - state: enabled - name: "{{ item }}" - loop: - - cappyishihara/opentabletdriver - - atim/lazygit - - fale/gopass - - peterwu/iosevka - - # Package installations. - - name: Install packages from enabled copr repositories - dnf: - state: present - name: - - lazygit - - opentabletdriver - - golang-github-gopasspw-gopass - - iosevka-fonts - - iosevka-curly-fonts - - iosevka-curly-slab-fonts - - iosevka-slab-fonts - - iosevka-etoile-fonts - - - name: Set minimal development environment - dnf: - state: present - name: - - neovim - - python-neovim - - git - - kitty - - kitty-doc - - kitty-terminfo - - man-db - - man-pages - - - name: Install additional development tools - dnf: - state: present - name: - - tealdeer - - bat - - fzf - - exa - - ripgrep - - sqlite - - zoxide - - direnv - - - name: Install RPM development tools - dnf: - state: present - name: - - rpm-build - - go-rpm-macros - - - name: Setup container development tools - dnf: - state: present - name: - - podman - - toolbox - - openssl - - - name: Install backup tools - dnf: - state: present - name: - - borgbackup - - borgmatic - - - name: Install (Doom) Emacs with its required dependencies - dnf: - state: present - name: - - emacs - - libvterm - - aspell - - aspell-en - - wordnet - - zstd - - - name: Install web-related tools - dnf: - state: present - name: - - thunderbird - - chromium - - firefox - - - name: Install extra dependencies - dnf: - state: present - name: - - editorconfig - - ImageMagick - - ImageMagick-doc - - ImageMagick-libs - - hyperfine - - libtree-sitter - - recoll - - recoll-gssp - - recoll-kio - - starship - - - name: Install Fedora COPR dev't tools - dnf: - state: present - name: - - copr-cli - - dnf-plugins-core - - - name: Install i18n tools - dnf: - state: present - name: - - fcitx5 - - fcitx5-configtool - - fcitx5-gtk4 - - fcitx5-lua - - fcitx5-mozc - - fcitx5-rime - - librime - - librime-tools - - mozc - - - name: Install Ansible - dnf: - state: present - name: - - ansible - - ansible-doc - - ansible-collection-community-general - - python3-psutil - - - name: Install fonts - dnf: - state: present - name: - - adobe-source-code-pro-fonts - - adobe-source-sans-pro-fonts - - adobe-source-serif-pro-fonts - - google-noto-cjk-fonts - - google-noto-cjk-fonts-common - - google-noto-emoji-fonts - - google-noto-sans-fonts - - google-noto-serif-fonts - - # Install applications from Flatpak - - name: Install applications from 'flathub' Flatpak remote - flatpak: - state: present - name: "{{ item }}" - remote: flathub - loop: - - com.github.tchx84.Flatseal - - com.github.wwmm.easyeffects - - com.obsproject.Studio - - com.play0ad.zeroad - - com.remnantsoftheprecursors.ROTP - - com.usebottles.bottles - - com.valvesoftware.Steam - - io.github.lainsce.Emulsion - - org.blender.Blender - - org.inkscape.Inkscape - - org.kde.krita - - org.musescore.MuseScore - - org.pipewire.Helvum - - org.zrythm.Zrythm - - re.sonny.Junction - - re.sonny.Tangram - - - name: Install applications from 'kdeapps' Flatpak remote - flatpak: - state: present - name: "{{ item }}" - remote: kdeapps - loop: - - org.kde.krita-nightly - - - name: Install applications from 'flathub-beta' Flatpak remote - flatpak: - state: present - name: "{{ item }}" - remote: flathub-beta - loop: - - net.lutris.Lutris - - - name: Install applications from 'gnome-nightly' Flatpak remote - flatpak: - state: present - name: "{{ item }}" - remote: gnome-nightly - loop: - - org.gimp.GIMP - - # Configure desktop environment. - - name: Install dconf keyfiles - copy: - src: ./files/dconf/ - dest: /etc/dconf/db/a-happy-gnome.d - - - name: Set 'user' dconf profile with the custom GNOME config - ansible.builtin.shell: echo "system-db:a-happy-gnome" >> /etc/dconf/profile/user - - - name: Enable night light in GNOME - dconf: - state: present - key: /org/gnome/settings-daemon/plugins/color/night-light-enabled - value: "true" - - # TODO: - # * Configure GNOME extensions diff --git a/apps/emacs/tasks/main.yml b/roles/apps/emacs/tasks/main.yml similarity index 100% rename from apps/emacs/tasks/main.yml rename to roles/apps/emacs/tasks/main.yml