From 533e7a6a9dbe60f795427ce0cc5b69f1962c9992 Mon Sep 17 00:00:00 2001 From: Miguel Villa Floran Date: Wed, 15 May 2024 10:22:47 -0700 Subject: [PATCH] Add support for flatpak, neovim, xorg --- README.md | 22 +++++++++++++----- ansible-install | 16 ++++++++------ local.yml | 28 +++++++++++++++++------ tasks/core-setup.yml | 45 +++++++++++++++++++++++++++++++++++++ tasks/discord-setup.yml | 28 +++++++++++++++++++++++ tasks/flatpak-setup.yml | 42 +++++++++++++++++++++++++++++++++++ tasks/gui-setup.yml | 18 +++++++++++++++ tasks/neovim-setup.yml | 48 ++++++++++++++++++++++++++++++++++++++++ tasks/node-setup.yml | 4 ++++ tasks/slack.yml | 24 -------------------- tasks/suckless-setup.yml | 0 11 files changed, 232 insertions(+), 43 deletions(-) create mode 100644 tasks/core-setup.yml create mode 100644 tasks/discord-setup.yml create mode 100644 tasks/flatpak-setup.yml create mode 100644 tasks/gui-setup.yml create mode 100644 tasks/neovim-setup.yml delete mode 100644 tasks/slack.yml create mode 100644 tasks/suckless-setup.yml diff --git a/README.md b/README.md index 456157d..86e05f9 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,25 @@ To get a local copy of the project up and running on your machine, follow these ### Installation -It is best to run this playbook remotely, as it is designed to be executed on a fresh install of Linux. To do so, run the following command: +It is best to run this playbook remotely, as it is designed to be executed on a fresh install of Linux. To do so, run the following commands: -```bash -bash < <(curl -s https://raw.githubusercontent.com/Kaweees/ansible/main/ansible-install) -``` +1. Add your user to the sudoers group + ```bash + # execute the following commands from root + apt install -y sudo curl + sudo usermod -aG sudo + ``` +2. Execute the ansible-install script + ```bash + bash < <(curl -s https://raw.githubusercontent.com/Kaweees/ansible/main/ansible-install) + ``` +3. Start and enable NetworkManager + ```bash + sudo systemctl start NetworkManager #.service + sudo systemctl enable NetworkManager #.service + ``` -Enter your machine's password when prompted. +Enter your machine's password when prompted by Ansible. ## Usage diff --git a/ansible-install b/ansible-install index 7165aac..4ae7d21 100644 --- a/ansible-install +++ b/ansible-install @@ -1,8 +1,8 @@ #!/usr/bin/env bash # # Title: Kaweees's Ansible Playbook -# Description: A bash script to install Kaweee's Ansible playbook and run it. -# Author: Your Name +# Description: A bash script to install Kaweees's Ansible playbook and run it. +# Author: Miguel Villa Floran title() { local color='\033[1;37m' @@ -16,9 +16,11 @@ title "Greetings, $USER. Let's install Kaweees's Ansible Playbook." sudo apt update -y && sudo apt upgrade -y sudo apt install -y software-properties-common sudo add-apt-repository --yes --update ppa:ansible/ansible -sudo apt install -y ansible git +sudo apt install -y ansible git cowsay -# Execute Ansible playbook -ansible-pull -K -U https://github.com/Kaweees/ansible.git -t install local.yml -# Or run locally -# ansible-playbook -K local.yml -t install +# Execute Ansible playbook remotely +# ansible-pull -K -U https://github.com/Kaweees/ansible.git local.yml --ask-become-pass --tags minimal-install + +# Clone and execute Ansible playbook locally +git clone https://github.com/Kaweees/ansible.git ~/Documents/GitHub/Projects/ansible --recusive && cd ~/Documents/GitHub/Projects/ansible +ansible-playbook -K local.yml --ask-become-pass --tags minimal-install diff --git a/local.yml b/local.yml index da3730a..1e27620 100644 --- a/local.yml +++ b/local.yml @@ -1,5 +1,6 @@ --- -- hosts: localhost +- name: Kaweees's Ansible Playbook + hosts: localhost become: true vars_files: @@ -13,6 +14,15 @@ personal: "{{ lookup('env', 'HOME') }}/personal" pre_tasks: + - name: Add non-free, contrib repos + become: true + replace: + path: /etc/apt/sources.list + regexp: '(non-free-firmware)$' + replace: 'contrib non-free' + tags: + - minimal-install + - install - name: Update Apt cache become: true apt: @@ -20,14 +30,18 @@ update_cache: true state: present tags: + - minimal-install - install - - core tasks: - include: tasks/ssh.yml - include: tasks/core-setup.yml - - include: tasks/node-setup.yml - - include: tasks/zsh-setup.yml - - include: tasks/slack-setup.yml - - include: tasks/dotfiles.yml - - include: tasks/git-setup.yml + - include: tasks/gui-setup.yml + - include: tasks/flatpak-setup.yml + - include: tasks/discord-setup.yml + - include: tasks/neovim-setup.yml + # - include: tasks/zsh-setup.yml + # - include: tasks/dotfiles.yml + # - include: tasks/suckless-setup.yml + # - include: tasks/node-setup.yml + # - include: tasks/git-setup.yml diff --git a/tasks/core-setup.yml b/tasks/core-setup.yml new file mode 100644 index 0000000..1151217 --- /dev/null +++ b/tasks/core-setup.yml @@ -0,0 +1,45 @@ +- name: Install required CLI utilities + become: true + package: + name: + - ansible + - atool + - autoconf + - build-essential + - curl + - dkms # Dynamic Kernel Module Support + - ffmpeg + - firmware-misc-nonfree + - fzf + - gcc + - git + - libtool + - lm-sensors + - make + - man + - network-manager # nmtui + - network-manager-gnome # nm-connection-editor + - nvidia-driver + - ripgrep + - stow + - sudo + - tree + - unzip + - wget + tags: + - minimal-install + - install + - core + +- name: Install additional CLI utilities + become: true + package: + name: + - htop + - neofetch + - nmap + - ranger + - cowsay + tags: + - install + - core diff --git a/tasks/discord-setup.yml b/tasks/discord-setup.yml new file mode 100644 index 0000000..7e07fee --- /dev/null +++ b/tasks/discord-setup.yml @@ -0,0 +1,28 @@ + +- name: Download Discord + get_url: + url: "https://discord.com/api/download?platform=linux&format=deb" + dest: /tmp/discord.deb + tags: + - minimal-install + - install + - discord + +- name: Install Discord + become: true + apt: + deb: /tmp/discord.deb + state: present + tags: + - minimal-install + - install + - discord + +- name: Remove Discord .deb package + file: + path: /tmp/discord.deb + state: absent + tags: + - minimal-install + - install + - discord diff --git a/tasks/flatpak-setup.yml b/tasks/flatpak-setup.yml new file mode 100644 index 0000000..ad58ad2 --- /dev/null +++ b/tasks/flatpak-setup.yml @@ -0,0 +1,42 @@ +- name: Install flatpak + become: true + package: + name: + - flatpak + tags: + - minimal-install + - install + - flatpak + +- name: Add flathub repo + become: true + shell: flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + tags: + - minimal-install + - install + - flatpak + +- name: Install flatpak core utilities + flatpak: + name: + - com.github.tchx84.Flatseal + - com.vivaldi.Vivaldi + + tags: + - minimal-install + - install + - flatpak + +- name: Install flatpak GUI extras + flatpak: + name: + - camp.nook.nookdesktop + - com.axosoft.GitKraken + - com.slack.Slack + - com.spotify.Client + - io.github.shiftey.Desktop + - org.signal.Signal + - org.qbittorrent.qBittorrent + tags: + - install + - flatpak diff --git a/tasks/gui-setup.yml b/tasks/gui-setup.yml new file mode 100644 index 0000000..67c17d9 --- /dev/null +++ b/tasks/gui-setup.yml @@ -0,0 +1,18 @@ +- name: Install Xorg utilities + become: true + package: + name: + - xserver-xorg-core + # - xserver-xorg-video-nvidia + # - xorg-video-abi-11 + - xinit + - xinput + - xclip + - x11-xserver-utils + - libx11-dev + - libxinerama-dev + - libxft-dev + tags: + - minimal-install + - install + - xorg diff --git a/tasks/neovim-setup.yml b/tasks/neovim-setup.yml new file mode 100644 index 0000000..7f67708 --- /dev/null +++ b/tasks/neovim-setup.yml @@ -0,0 +1,48 @@ +- name: Download neovim + become: true + ansible.builtin.shell: + cmd: "curl https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz" + tags: + - minimal-install + - install + - neovim +- name: Remove old neovim directory + become: true + ansible.builtin.shell: + cmd: "rm -rf /opt/nvim-linux64" + tags: + - minimal-install + - install + - neovim +- name: Create neovim directory + become: true + ansible.builtin.shell: + cmd: "mkdir -p /opt/nvim-linux64" + tags: + - minimal-install + - install + - neovim +- name: Change neovim directory to read and execute for everyone +become: true + ansible.builtin.shell: + cmd: "chmod a+rX /opt/nvim-linux64" + tags: + - minimal-install + - install + - neovim +- name: Extract neovim + become: true + ansible.builtin.shell: + cmd: "tar -C /opt -xzf nvim-linux64.tar.gz" + tags: + - minimal-install + - install + - neovim +- name: Create symlink for neovim + become: true + ansible.builtin.shell: + cmd: "ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/" + tags: + - minimal-install + - install + - neovim diff --git a/tasks/node-setup.yml b/tasks/node-setup.yml index a599127..ad292a1 100644 --- a/tasks/node-setup.yml +++ b/tasks/node-setup.yml @@ -38,3 +38,7 @@ - install - node with_items: "{{ nodejs_npm_global_packages }}" + +- name: Install pnpm + ansible.builtin.shell: + cmd: "curl -fsSL https://get.pnpm.io/install.sh | sh -" diff --git a/tasks/slack.yml b/tasks/slack.yml deleted file mode 100644 index 5740ef4..0000000 --- a/tasks/slack.yml +++ /dev/null @@ -1,24 +0,0 @@ -- name: Download Slack - get_url: - url: https://downloads.slack-edge.com/releases/linux/4.32.122/prod/x64/slack-desktop-4.32.122-amd64.deb - dest: /tmp/slack.deb - tags: - - install - - slack - -- name: Remove Any previous slacks - become: true - apt: - name: slack-desktop - state: absent - tags: - - install - - slack - -- name: Install Slack .deb package - become: true - apt: - deb: /tmp/slack.deb - tags: - - install - - slack diff --git a/tasks/suckless-setup.yml b/tasks/suckless-setup.yml new file mode 100644 index 0000000..e69de29