diff --git a/Makefile b/Makefile index 93f2f5a..01325ad 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -run: - ansible-playbook playbooks/setup.yml -i inventory/hosts.yml -K +%: + ansible-playbook playbooks/$@.yml -i inventory/hosts.yml -K .PHONY: run diff --git a/README.md b/README.md index ff991e0..c0acd1a 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,4 @@ - Telegram (maybe only possible to download) - Oh my zsh? - Cool neovim setup -- wireshark +- syncthing diff --git a/playbooks/asdf.yml b/playbooks/asdf.yml new file mode 100644 index 0000000..04d8e28 --- /dev/null +++ b/playbooks/asdf.yml @@ -0,0 +1,4 @@ +- name: Install asdf + hosts: self + roles: + - asdf diff --git a/playbooks/neovim.yml b/playbooks/neovim.yml new file mode 100644 index 0000000..dc44cf4 --- /dev/null +++ b/playbooks/neovim.yml @@ -0,0 +1,4 @@ +- name: Install neovim + hosts: self + roles: + - neovim diff --git a/playbooks/signal.yml b/playbooks/signal.yml new file mode 100644 index 0000000..2cb2a8b --- /dev/null +++ b/playbooks/signal.yml @@ -0,0 +1,4 @@ +- name: Install Signal + hosts: self + roles: + - signal diff --git a/playbooks/virtualbox.yml b/playbooks/virtualbox.yml new file mode 100644 index 0000000..00f01c9 --- /dev/null +++ b/playbooks/virtualbox.yml @@ -0,0 +1,4 @@ +- name: Install VirtualBox + hosts: self + roles: + - virtualbox diff --git a/playbooks/vscodium.yml b/playbooks/vscodium.yml new file mode 100644 index 0000000..b829de3 --- /dev/null +++ b/playbooks/vscodium.yml @@ -0,0 +1,4 @@ +- name: Install VSCodium + hosts: self + roles: + - vscodium diff --git a/playbooks/zsh.yml b/playbooks/zsh.yml new file mode 100644 index 0000000..0d7bed5 --- /dev/null +++ b/playbooks/zsh.yml @@ -0,0 +1,4 @@ +- name: Install zsh + hosts: self + roles: + - zsh diff --git a/roles/asdf/tasks/main.yml b/roles/asdf/tasks/main.yml new file mode 100644 index 0000000..5d3e915 --- /dev/null +++ b/roles/asdf/tasks/main.yml @@ -0,0 +1,43 @@ +- name: Install asdf + git: + repo: https://github.com/asdf-vm/asdf.git + dest: ~/.asdf +- name: Install Erlang prerequisite APT packages + become: true + apt: + state: present + update_cache: true + cache_valid_time: 86400 # One day + pkg: + - build-essential + - autoconf + - m4 + - libncurses5-dev + - libwxgtk3.0-gtk3-dev + - libwxgtk-webview3.0-gtk3-dev + - libgl1-mesa-dev + - libglu1-mesa-dev + - libpng-dev + - libssh-dev + - unixodbc-dev + - xsltproc + - fop + - libxml2-utils + - libncurses-dev + - openjdk-11-jdk +- name: Install asdf Erlang plugin + shell: asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git + args: + creates: ~/.asdf/plugins/erlang +- name: Install Elixir prerequisite APT packages + become: true + apt: + state: present + update_cache: true + cache_valid_time: 86400 # One day + pkg: + - unzip +- name: Install asdf Elixir plugin + shell: asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git + args: + creates: ~/.asdf/plugins/elixir diff --git a/roles/neovim/tasks/main.yml b/roles/neovim/tasks/main.yml new file mode 100644 index 0000000..2517f2a --- /dev/null +++ b/roles/neovim/tasks/main.yml @@ -0,0 +1,38 @@ +- name: Install prerequisite APT packages + # https://github.com/neovim/neovim/wiki/Building-Neovim#build-prerequisites + become: true + apt: + state: latest + update_cache: yes + cache_valid_time: 86400 # One day + pkg: + - ninja-build + - gettext + - libtool + - libtool-bin + - autoconf + - automake + - cmake + - g++ + - pkg-config + - unzip + - curl + - doxygen +- name: Pull neovim repository + become: true + git: + repo: https://github.com/neovim/neovim.git + dest: ~/neovim +- name: Build neovim + become: true + make: + chdir: ~/neovim + params: + CMAKE_BUILD_TYPE: RelWithDebInfo + changed_when: false # I lie a bit, but neovim makefile doesn't cooperate +- name: Install neovim + become: true + make: + chdir: ~/neovim + target: install + changed_when: false # Idem diff --git a/roles/signal/tasks/main.yml b/roles/signal/tasks/main.yml new file mode 100644 index 0000000..dee82c0 --- /dev/null +++ b/roles/signal/tasks/main.yml @@ -0,0 +1,18 @@ +- name: Get Signal APT key + become: true + get_url: + url: https://updates.signal.org/desktop/apt/keys.asc + dest: /etc/apt/trusted.gpg.d/signal.asc +- name: Install Signal APT repository + become: true + apt_repository: + repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/signal.asc] https://updates.signal.org/desktop/apt xenial main" + state: present +- name: Install Signal + become: true + apt: + state: latest + update_cache: yes + cache_valid_time: 86400 # One day + pkg: + - signal-desktop diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index 7b79761..ce6bcf6 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -1,33 +1,3 @@ -- name: Get Signal APT key - become: true - get_url: - url: https://updates.signal.org/desktop/apt/keys.asc - dest: /etc/apt/trusted.gpg.d/signal.asc -- name: Install Signal APT repository - become: true - apt_repository: - repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/signal.asc] https://updates.signal.org/desktop/apt xenial main" - state: present -- name: Get VSCodium APT key - become: true - get_url: - url: https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg - dest: /etc/apt/trusted.gpg.d/vscodium-archive-keyring.asc -- name: Install VSCodium APT repository - become: true - apt_repository: - repo: "deb [signed-by=/etc/apt/trusted.gpg.d/vscodium-archive-keyring.asc ] https://download.vscodium.com/debs vscodium main" - state: present -- name: Get VirtualBox APT key - become: true - get_url: - url: https://www.virtualbox.org/download/oracle_vbox_2016.asc - dest: /etc/apt/trusted.gpg.d/oracle_vbox_2016.asc -- name: Install VirtualBox APT repository - become: true - apt_repository: - repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/oracle_vbox_2016.asc] https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib" - state: present - name: Update repositories become: true apt: @@ -35,7 +5,7 @@ state: latest update_cache: yes cache_valid_time: 86400 # One day -- name: Install global packages +- name: Install APT packages become: true apt: state: latest @@ -43,7 +13,6 @@ - git - make - keepassxc - - zsh - ripgrep - curl - unzip @@ -51,89 +20,14 @@ - libreoffice-impress - libreoffice-writer - gimp - - signal-desktop - nextcloud-desktop - - codium - tree - - virtualbox-6.1 - wireshark - # Erlang stuff: https://github.com/asdf-vm/asdf-erlang#before-asdf-install - - build-essential - - autoconf - - m4 - - libncurses5-dev - - libwxgtk3.0-gtk3-dev - - libwxgtk-webview3.0-gtk3-dev - - libgl1-mesa-dev - - libglu1-mesa-dev - - libpng-dev - - libssh-dev - - unixodbc-dev - - xsltproc - - fop - - libxml2-utils - - libncurses-dev - - openjdk-11-jdk - # Neovim stuff: https://github.com/neovim/neovim/wiki/Building-Neovim#build-prerequisites - - ninja-build - - gettext - - libtool - - libtool-bin - - automake - - cmake - - g++ - - pkg-config - - doxygen -- name: Set default shell to zsh - become: true - user: - name: "{{ ansible_user_id }}" - shell: /usr/bin/zsh - name: Install .gitconfig template: src: "{{ role_path }}/templates/.gitconfig.j2" dest: ~/.gitconfig -- name: Install asdf - git: - repo: https://github.com/asdf-vm/asdf.git - dest: ~/.asdf -- name: Install .zshrc - template: - src: "{{ role_path }}/templates/.zshrc.j2" - dest: ~/.zshrc -- name: Install asdf Erlang plugin - shell: asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git - args: - creates: ~/.asdf/plugins/erlang -- name: Install asdf Elixir plugin - shell: asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git - args: - creates: ~/.asdf/plugins/elixir - name: Install Regolith Xresources file template: src: "{{ role_path }}/templates/Xresources.j2" dest: ~/.config/regolith2/Xresources -- name: Check VSCodium extensions - setup: - fact_path: "{{ role_path }}/facts" -- name: Install VSCodium extensions - shell: "codium --install-extension {{ item }}" - loop: "{{ vscodium_extensions | difference(ansible_facts.ansible_local.vscodium_extensions) }}" -- name: Pull neovim repository - become: true - git: - repo: https://github.com/neovim/neovim.git - dest: ~/neovim -- name: Build neovim - become: true - make: - chdir: ~/neovim - params: - CMAKE_BUILD_TYPE: RelWithDebInfo - changed_when: false # I lie a bit, but neovim makefile doesn't cooperate -- name: Install neovim - become: true - make: - chdir: ~/neovim - target: install - changed_when: false # Idem diff --git a/roles/virtualbox/tasks/main.yml b/roles/virtualbox/tasks/main.yml new file mode 100644 index 0000000..641de2f --- /dev/null +++ b/roles/virtualbox/tasks/main.yml @@ -0,0 +1,18 @@ +- name: Get VirtualBox APT key + become: true + get_url: + url: https://www.virtualbox.org/download/oracle_vbox_2016.asc + dest: /etc/apt/trusted.gpg.d/oracle_vbox_2016.asc +- name: Install VirtualBox APT repository + become: true + apt_repository: + repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/oracle_vbox_2016.asc] https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib" + state: present +- name: Install VirtualBox + become: true + apt: + state: latest + update_cache: yes + cache_valid_time: 86400 # One day + pkg: + - virtualbox-6.1 diff --git a/roles/system/facts/vscodium_extensions.fact b/roles/vscodium/facts/vscodium_extensions.fact similarity index 100% rename from roles/system/facts/vscodium_extensions.fact rename to roles/vscodium/facts/vscodium_extensions.fact diff --git a/roles/vscodium/tasks/main.yml b/roles/vscodium/tasks/main.yml new file mode 100644 index 0000000..35e6ed7 --- /dev/null +++ b/roles/vscodium/tasks/main.yml @@ -0,0 +1,24 @@ +- name: Get VSCodium APT key + become: true + get_url: + url: https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg + dest: /etc/apt/trusted.gpg.d/vscodium-archive-keyring.asc +- name: Install VSCodium APT repository + become: true + apt_repository: + repo: "deb [signed-by=/etc/apt/trusted.gpg.d/vscodium-archive-keyring.asc ] https://download.vscodium.com/debs vscodium main" + state: present +- name: Install VSCodium + become: true + apt: + state: latest + update_cache: yes + cache_valid_time: 86400 # One day + pkg: + codium +- name: Check VSCodium extensions + setup: + fact_path: "{{ role_path }}/facts" +- name: Install VSCodium extensions + shell: "codium --install-extension {{ item }}" + loop: "{{ vscodium_extensions | difference(ansible_facts.ansible_local.vscodium_extensions) }}" diff --git a/roles/zsh/tasks/main.yml b/roles/zsh/tasks/main.yml new file mode 100644 index 0000000..d32e461 --- /dev/null +++ b/roles/zsh/tasks/main.yml @@ -0,0 +1,17 @@ +- name: Install zsh + become: true + apt: + state: latest + update_cache: yes + cache_valid_time: 86400 # One day + pkg: + - zsh +- name: Set default shell to zsh + become: true + user: + name: "{{ ansible_user_id }}" + shell: /usr/bin/zsh +- name: Install .zshrc + template: + src: "{{ role_path }}/templates/.zshrc.j2" + dest: ~/.zshrc diff --git a/roles/system/templates/.zshrc.j2 b/roles/zsh/templates/.zshrc.j2 similarity index 100% rename from roles/system/templates/.zshrc.j2 rename to roles/zsh/templates/.zshrc.j2