From 755493d155154266f6dcaf74675812476f2257e7 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 15 Mar 2025 16:57:00 +0100 Subject: [PATCH] Group vars refactor --- .gitlab-ci.yml | 26 ---- .prettierrc.yml | 5 - ansible.cfg | 1 + archlinux.yml | 39 ------ debian.yml | 14 --- files/{ => desktop}/docker-daemon.json | 0 group_vars/all/git.yml | 4 + group_vars/all/neovim.yml | 46 ++++++++ group_vars/all/system.yml | 4 + group_vars/arch/aur.yml | 40 +++++++ group_vars/arch/neovim.yml | 48 ++++++++ group_vars/arch/system.yml | 17 +++ .../debian/neovim.yml | 21 +--- group_vars/debian/system.yml | 7 ++ inventory.yml | 22 ++++ package-lock.json | 33 ------ package.json | 5 - playbook.yml | 72 ++++++++++++ tasks/{ => arch}/aur-package.yml | 21 ++-- tasks/{ => arch}/aur.yml | 16 +-- tasks/{ => arch}/docker.yml | 2 +- tasks/arch/neovim.yml | 6 + tasks/{ => arch}/nvm.yml | 11 +- tasks/{ => arch}/python.yml | 0 tasks/debian/neovim.yml | 57 +++++++++ tasks/neovim.yml | 70 ----------- templates/{ => debian}/nvim.profile.j2 | 0 templates/subgid.j2 | 1 - templates/subuid.j2 | 1 - vars/archlinux.yml | 111 ------------------ vars/main.yml | 53 --------- 31 files changed, 355 insertions(+), 398 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100644 .prettierrc.yml delete mode 100644 archlinux.yml delete mode 100644 debian.yml rename files/{ => desktop}/docker-daemon.json (100%) create mode 100644 group_vars/all/git.yml create mode 100644 group_vars/all/neovim.yml create mode 100644 group_vars/all/system.yml create mode 100644 group_vars/arch/aur.yml create mode 100644 group_vars/arch/neovim.yml create mode 100644 group_vars/arch/system.yml rename vars/debian.yml => group_vars/debian/neovim.yml (77%) create mode 100644 group_vars/debian/system.yml create mode 100644 inventory.yml delete mode 100644 package-lock.json delete mode 100644 package.json create mode 100644 playbook.yml rename tasks/{ => arch}/aur-package.yml (68%) rename tasks/{ => arch}/aur.yml (61%) rename tasks/{ => arch}/docker.yml (97%) create mode 100644 tasks/arch/neovim.yml rename tasks/{ => arch}/nvm.yml (56%) rename tasks/{ => arch}/python.yml (100%) create mode 100644 tasks/debian/neovim.yml rename templates/{ => debian}/nvim.profile.j2 (100%) delete mode 100644 templates/subgid.j2 delete mode 100644 templates/subuid.j2 delete mode 100644 vars/archlinux.yml delete mode 100644 vars/main.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index b53fdba..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,26 +0,0 @@ -stages: - - lint - - test - -cache: - key: $CI_COMMIT_REF_SLUG - paths: - - .cache/pip - - node_modules/ - -lint: - stage: lint - image: node:current-alpine - before_script: - - npm install - script: - - npx prettier '**/*.yml' --check - -syntax-test: - stage: test - image: python:latest - before_script: - - pip install ansible --quiet - - ansible-galaxy install --role-file requirements.yml - script: - - ansible-playbook playbook.yml --syntax-check diff --git a/.prettierrc.yml b/.prettierrc.yml deleted file mode 100644 index 0cb31e6..0000000 --- a/.prettierrc.yml +++ /dev/null @@ -1,5 +0,0 @@ -singleQuote: true -printWidth: 90 -tabWidth: 2 -useTabs: false -bracketSpacing: true diff --git a/ansible.cfg b/ansible.cfg index 4c41b64..ccea318 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,5 +1,6 @@ [defaults] roles_path = ./roles +inventory = inventory.yml [privilege_escalation] become_ask_pass = True diff --git a/archlinux.yml b/archlinux.yml deleted file mode 100644 index 109d1a8..0000000 --- a/archlinux.yml +++ /dev/null @@ -1,39 +0,0 @@ -- hosts: localhost - pre_tasks: - - name: install packages - become: true - package: - name: '{{ item }}' - state: present - loop: '{{ packages }}' - - name: add git forge to known hosts - include_role: - name: common - tasks_from: 'known_hosts.yml' - vars: - user: '{{ ansible_user_id }}' - items: - - { domain: '{{ git_domain }}', key: '{{ git_host_key }}' } - roles: - - common - tasks: - - import_tasks: 'tasks/dotfiles.yml' - - - name: Include neovim tasks - import_tasks: 'tasks/neovim.yml' - tags: neovim - - - name: gather package facts - package_facts: - manager: pacman - - import_tasks: 'tasks/aur.yml' - - import_tasks: 'tasks/docker.yml' - - - name: setup python versions - include_tasks: 'tasks/python.yml' - loop: '{{ python_versions }}' - - - import_tasks: 'tasks/nvm.yml' - vars_files: - - 'vars/main.yml' - - 'vars/archlinux.yml' diff --git a/debian.yml b/debian.yml deleted file mode 100644 index 16a0d80..0000000 --- a/debian.yml +++ /dev/null @@ -1,14 +0,0 @@ -- hosts: localhost - pre_tasks: - - name: install packages - become: true - package: - name: '{{ item }}' - state: present - loop: '{{ packages }}' - tasks: - - import_tasks: 'tasks/dotfiles.yml' - - import_tasks: 'tasks/neovim.yml' - vars_files: - - 'vars/main.yml' - - 'vars/debian.yml' diff --git a/files/docker-daemon.json b/files/desktop/docker-daemon.json similarity index 100% rename from files/docker-daemon.json rename to files/desktop/docker-daemon.json diff --git a/group_vars/all/git.yml b/group_vars/all/git.yml new file mode 100644 index 0000000..c776d15 --- /dev/null +++ b/group_vars/all/git.yml @@ -0,0 +1,4 @@ +dotfiles_repo: 'git@forgejo.fudiggity.nl:sonny/dotfiles.git' + +git_domain: 'forgejo.fudiggity.nl' +git_host_key: 'forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+' diff --git a/group_vars/all/neovim.yml b/group_vars/all/neovim.yml new file mode 100644 index 0000000..2e1e9ab --- /dev/null +++ b/group_vars/all/neovim.yml @@ -0,0 +1,46 @@ +neovim_plugins: + - url: 'https://forgejo.fudiggity.nl/sonny/source-link.lua' + name: 'source-link' + - url: 'https://github.com/nvim-tree/nvim-tree.lua' + name: 'nvim-tree' + - url: 'https://github.com/nvim-tree/nvim-web-devicons' + name: 'nvim-tree-icons' + - url: 'https://github.com/neovim/nvim-lspconfig' + name: 'nvim-lspconfig' + - url: 'https://github.com/hrsh7th/nvim-cmp' + name: 'nvim-cmp' + - url: 'https://github.com/hrsh7th/cmp-buffer' + name: 'cmp-buffer' + - url: 'https://github.com/hrsh7th/cmp-path' + name: 'cmp-path' + - url: 'https://github.com/hrsh7th/cmp-omni' + name: 'cmp-omni' + - url: 'https://github.com/hrsh7th/cmp-nvim-lsp' + name: 'cmp-nvim-lsp' + - url: 'https://github.com/hrsh7th/cmp-nvim-lua' + name: 'cmp-nvim-lua' + - url: 'https://github.com/nvim-treesitter/nvim-treesitter' + name: 'nvim-treesitter' + - url: 'https://github.com/nvim-lua/plenary.nvim' + name: 'plenary.nvim' + - url: 'https://github.com/nvim-telescope/telescope-fzf-native.nvim' + name: 'telescope-fzf-native.nvim' + - url: 'https://github.com/nvim-telescope/telescope.nvim' + name: 'telescope.nvim' + version: '0.1.x' + - url: 'https://github.com/L3MON4D3/LuaSnip' + name: 'luasnip' + version: 'v1.0.0' + - url: 'https://github.com/lewis6991/gitsigns.nvim' + name: 'gitsigns.nvim' + version: 'v0.9.0' + - url: 'https://github.com/nvim-lualine/lualine.nvim' + name: 'lualine' + - url: 'https://github.com/lukas-reineke/indent-blankline.nvim' + name: 'indent-blankline.nvim' + version: 'v3.7.2' + - url: 'https://github.com/projekt0n/github-nvim-theme.git' + name: 'github-colors' + version: 'v1.1.2' + +language_servers: [] diff --git a/group_vars/all/system.yml b/group_vars/all/system.yml new file mode 100644 index 0000000..f57d500 --- /dev/null +++ b/group_vars/all/system.yml @@ -0,0 +1,4 @@ +xdg_config_dir: '{{ ansible_env.HOME }}/.config' +xdg_data_dir: '{{ ansible_env.HOME }}/.local/share' + +packages: [] diff --git a/group_vars/arch/aur.yml b/group_vars/arch/aur.yml new file mode 100644 index 0000000..6f1c646 --- /dev/null +++ b/group_vars/arch/aur.yml @@ -0,0 +1,40 @@ +aur_packages: + - url: 'https://aur.archlinux.org/nvm.git' + name: 'nvm' + package_name: 'nvm' + version: '0.40.0-1' + arch: 'any' + +aur_build_dir: '/usr/local/src' +python_build_dir: '/usr/local/src' +python_install_dir: '/opt' + +python_download_url: 'https://www.python.org/ftp/python' +python_versions: + - version: 3.12.9 + path: 'python3.12' + binary: 'python3.12' + + - version: 3.11.9 + path: 'python3.11' + binary: 'python3.11' + + - version: 3.10.0 + path: 'python3.10' + binary: 'python3.10' + + - version: 3.9.14 + path: 'python3.9' + binary: 'python3.9' + + - version: 3.8.14 + path: 'python3.8' + binary: 'python3.8' + + - version: 3.7.14 + path: 'python3.7' + binary: 'python3.7' + + - version: 3.6.15 + path: 'python3.6' + binary: 'python3.6' diff --git a/group_vars/arch/neovim.yml b/group_vars/arch/neovim.yml new file mode 100644 index 0000000..6963cd8 --- /dev/null +++ b/group_vars/arch/neovim.yml @@ -0,0 +1,48 @@ +language_servers: + - package: ansible-language-server + server_name: 'ansiblels' + auto_setup: true + + - package: typescript-language-server + server_name: 'ts_ls' + auto_setup: true + + - package: vscode-json-languageserver + server_name: 'jsonls' + auto_setup: true + + - package: vscode-css-languageserver + server_name: 'cssls' + auto_setup: true + + - package: bash-language-server + server_name: 'bashls' + auto_setup: true + + - package: marksman + server_name: 'marksman' + auto_setup: true + + - package: esbonio + server_name: 'esbonio' + auto_setup: true + + - package: lua-language-server + server_name: 'lua_ls' + auto_setup: true + + - package: yaml-language-server + server_name: 'yamlls' + auto_setup: false + + - package: vscode-html-languageserver + server_name: 'html' + auto_setup: false + + - package: ruff-lsp + server_name: 'ruff' + auto_setup: false + + - package: pyright + server_name: 'pyright' + auto_setup: false diff --git a/group_vars/arch/system.yml b/group_vars/arch/system.yml new file mode 100644 index 0000000..ae21d6d --- /dev/null +++ b/group_vars/arch/system.yml @@ -0,0 +1,17 @@ +packages: + - python + - git + - vim + - neovim + - python-pynvim + - wl-clipboard + - npm + - docker + - docker-compose + - iptables-nft + - fuse-overlayfs + - ttf-ibm-plex + - slirp4netns + - tree-sitter + - ripgrep + - uv diff --git a/vars/debian.yml b/group_vars/debian/neovim.yml similarity index 77% rename from vars/debian.yml rename to group_vars/debian/neovim.yml index cb7c8a3..c5e5319 100644 --- a/vars/debian.yml +++ b/group_vars/debian/neovim.yml @@ -1,19 +1,3 @@ -ansible_connection: local -ansible_python_interpreter: '/usr/bin/python3' - -packages: - - python3 - - git - - vim - - npm - - libtree-sitter0 - - ripgrep - -neovim: - version: 'v0.10.4' - install_path: '/opt/nvim' - download_checksum: sha256:95aaa8e89473f5421114f2787c13ae0ec6e11ebbd1a13a1bd6fcf63420f8073f - # TODO: add lua language server, see https://github.com/LuaLS/lua-language-server? language_servers: - package: '@ansible/ansible-language-server' @@ -27,3 +11,8 @@ language_servers: - package: bash-language-server server_name: 'bashls' auto_setup: true + +neovim: + version: 'v0.10.4' + install_path: '/opt/nvim' + download_checksum: sha256:95aaa8e89473f5421114f2787c13ae0ec6e11ebbd1a13a1bd6fcf63420f8073f diff --git a/group_vars/debian/system.yml b/group_vars/debian/system.yml new file mode 100644 index 0000000..56be4aa --- /dev/null +++ b/group_vars/debian/system.yml @@ -0,0 +1,7 @@ +packages: + - python3 + - git + - vim + - npm + - libtree-sitter0 + - ripgrep diff --git a/inventory.yml b/inventory.yml new file mode 100644 index 0000000..438697a --- /dev/null +++ b/inventory.yml @@ -0,0 +1,22 @@ +personal: + hosts: + xps: &xps + ansible_connection: local + ansible_become_method: community.general.run0 + desktop: &desktop + ansible_connection: local + ansible_become_method: community.general.run0 + fudiggity: &fudiggity + ansible_connection: local + +debian: + hosts: + fudiggity: + <<: *fudiggity + +arch: + hosts: + xps: + <<: *xps + desktop: + <<: *desktop diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 0db7ba2..0000000 --- a/package-lock.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "development", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "dependencies": { - "prettier": "^2.6.2" - } - }, - "node_modules/prettier": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz", - "integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - } - }, - "dependencies": { - "prettier": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz", - "integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==" - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index e1f5891..0000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "prettier": "^2.6.2" - } -} diff --git a/playbook.yml b/playbook.yml new file mode 100644 index 0000000..16f3272 --- /dev/null +++ b/playbook.yml @@ -0,0 +1,72 @@ +- name: Development provisioning + hosts: + - xps + - desktop + - fudiggity + pre_tasks: + - name: Verifying that a limit is set + ansible.builtin.fail: + msg: 'This playbook cannot be run with no limit' + run_once: true + when: ansible_limit is not defined + + - name: Install packages + become: true + ansible.builtin.package: + name: '{{ item }}' + state: present + loop: '{{ packages }}' + + - name: Add git forge to known hosts + ansible.builtin.include_role: + name: common + tasks_from: 'known_hosts.yml' + vars: + user: '{{ ansible_user_id }}' + items: + - domain: '{{ git_domain }}' + key: '{{ git_host_key }}' + roles: + - common + tasks: + - name: Setup dotfiles + ansible.builtin.import_tasks: 'tasks/dotfiles.yml' + tags: dotfiles + + - name: Include generic neovim tasks + ansible.builtin.import_tasks: 'tasks/neovim.yml' + tags: neovim + + - name: Include debian neovim tasks + ansible.builtin.import_tasks: 'tasks/debian/neovim.yml' + when: "'debian' in group_names" + tags: neovim + + - name: Provision Archlinux hosts + when: "'arch' in group_names" + block: + - name: Gather package facts + ansible.builtin.package_facts: + manager: pacman + + - name: Include arch neovim tasks + ansible.builtin.import_tasks: 'tasks/arch/neovim.yml' + when: "'arch' in group_names" + tags: neovim + + - name: Install AUR packages + ansible.builtin.import_tasks: 'tasks/arch/aur.yml' + tags: aur + + - name: Setup docker + ansible.builtin.import_tasks: 'tasks/arch/docker.yml' + tags: docker + + - name: Setup python versions + ansible.builtin.include_tasks: 'tasks/arch/python.yml' + loop: '{{ python_versions }}' + tags: python + + - name: Setup NVM + ansible.builtin.import_tasks: 'tasks/arch/nvm.yml' + tags: nvm diff --git a/tasks/aur-package.yml b/tasks/arch/aur-package.yml similarity index 68% rename from tasks/aur-package.yml rename to tasks/arch/aur-package.yml index 0abef44..e00f8ab 100644 --- a/tasks/aur-package.yml +++ b/tasks/arch/aur-package.yml @@ -1,8 +1,8 @@ -- name: set package directory - set_fact: +- name: Set package directory + ansible.builtin.set_fact: build_dir: '{{ aur_build_dir }}/{{ item.name }}' -- name: 'retrieve package name for {{ item.name }}' +- name: 'Retrieve package name for {{ item.name }}' command: argv: - grep @@ -12,7 +12,7 @@ - "{{ build_dir }}/PKGBUILD" register: pkg_name -- name: 'retrieve package version for {{ item.name }}' +- name: 'Retrieve package version for {{ item.name }}' command: argv: - grep @@ -22,7 +22,7 @@ - "{{ build_dir }}/PKGBUILD" register: pkg_version -- name: 'retrieve package release for {{ item.name }}' +- name: 'Retrieve package release for {{ item.name }}' command: argv: - grep @@ -32,21 +32,22 @@ - "{{ build_dir }}/PKGBUILD" register: pkg_release -- set_fact: +- name: Set package filename & version + ansible.builtin.set_fact: package_filename: '{{ pkg_name.stdout }}-{{ pkg_version.stdout }}-{{ pkg_release.stdout }}-{{ item.arch }}.pkg.tar.zst' installed_version: ansible_facts.packages[item.package_name].version|default('') -- name: 'build package {{ item.name }}' - command: 'makepkg --syncdeps --rmdeps --clean --noconfirm --force' +- name: 'Build package {{ item.name }}' + ansible.builtin.command: 'makepkg --syncdeps --rmdeps --clean --noconfirm --force' args: chdir: '{{ build_dir }}' creates: '{{ build_dir }}/{{ package_filename }}' register: package_build when: item.version != installed_version -- name: 'install {{ item.name }}' +- name: 'Install {{ item.name }}' become: true - pacman: + community.general.pacman: name: '{{ build_dir }}/{{ package_filename }}' state: present when: item.version != installed_version diff --git a/tasks/aur.yml b/tasks/arch/aur.yml similarity index 61% rename from tasks/aur.yml rename to tasks/arch/aur.yml index 0ae28e6..e31aab7 100644 --- a/tasks/aur.yml +++ b/tasks/arch/aur.yml @@ -1,19 +1,19 @@ -- name: retrieve directory stats - stat: +- name: Retrieve directory stats + ansible.builtin.stat: path: '{{ aur_build_dir }}/{{ item.name }}' loop: '{{ aur_packages }}' -- name: clone aur packages +- name: Clone aur packages become: true - git: + ansible.builtin.git: repo: '{{ item.url }}' dest: '{{ aur_build_dir }}/{{ item.name }}' update: true loop: '{{ aur_packages }}' -- name: change aur package directories owner +- name: Change aur package directories owner become: true - file: + ansible.builtin.file: path: '{{ aur_build_dir }}/{{ item.name }}' state: directory owner: '{{ ansible_user_id }}' @@ -21,6 +21,6 @@ recurse: true loop: '{{ aur_packages }}' -- name: build & install aur packages - include_tasks: 'tasks/aur-package.yml' +- name: Build & install aur packages + ansible.builtin.include_tasks: 'tasks/arch/aur-package.yml' loop: '{{ aur_packages }}' diff --git a/tasks/docker.yml b/tasks/arch/docker.yml similarity index 97% rename from tasks/docker.yml rename to tasks/arch/docker.yml index bd7ad77..c68a81f 100644 --- a/tasks/docker.yml +++ b/tasks/arch/docker.yml @@ -10,7 +10,7 @@ - name: Setup desktop configuration become: true ansible.builtin.file: - path: 'files/docker-daemon.json' + path: 'files/desktop/docker-daemon.json' dest: '/etc/docker/daemon.json' mode: '0755' when: ansible_hostname == 'desktop' diff --git a/tasks/arch/neovim.yml b/tasks/arch/neovim.yml new file mode 100644 index 0000000..0cccfa1 --- /dev/null +++ b/tasks/arch/neovim.yml @@ -0,0 +1,6 @@ +- name: Install language servers + become: true + community.general.pacman: + name: '{{ item }}' + state: present + loop: '{{ language_servers | map(attribute="package") | list }}' diff --git a/tasks/nvm.yml b/tasks/arch/nvm.yml similarity index 56% rename from tasks/nvm.yml rename to tasks/arch/nvm.yml index d99859a..b2f2e36 100644 --- a/tasks/nvm.yml +++ b/tasks/arch/nvm.yml @@ -1,13 +1,14 @@ -- set_fact: +- name: Set NVM install directory + ansible.builtin.set_fact: install_dir: '{{ xdg_config_dir }}/nvm' -- name: remove manually installed nvm install directory - file: +- name: Remove manually installed nvm install directory + ansible.builtin.file: path: '{{ install_dir }}' state: absent -- name: remove nvm entry from bashrc - lineinfile: +- name: Remove nvm entry from bashrc + ansible.builtin.lineinfile: path: '{{ ansible_env.HOME }}/.bashrc.override' line: > [ -s "{{ install_dir }}/nvm.sh" ] && \. "{{ install_dir }}/nvm.sh" # This loads nvm diff --git a/tasks/python.yml b/tasks/arch/python.yml similarity index 100% rename from tasks/python.yml rename to tasks/arch/python.yml diff --git a/tasks/debian/neovim.yml b/tasks/debian/neovim.yml new file mode 100644 index 0000000..939a741 --- /dev/null +++ b/tasks/debian/neovim.yml @@ -0,0 +1,57 @@ +- name: Install language servers on debian hosts + become: true + community.general.npm: + name: '{{ item }}' + global: true + loop: '{{ language_servers | map(attribute="package") | list }}' + +- name: Create neovim install directory + become: true + ansible.builtin.file: + state: directory + path: '{{ neovim.install_path }}' + owner: '{{ ansible_user_id }}' + group: '{{ ansible_user_gid }}' + mode: '0755' + +- name: Register the current neovim version + ansible.builtin.command: + argv: + - '{{ neovim.install_path }}/bin/nvim' + - '--version' + register: neovim_stats + changed_when: false + ignore_errors: true + +- name: Parse the current neovim version + ansible.builtin.set_fact: + neovim_installed_version: neovim_stats.stdout_lines[0] | regex_search('(v\d+\.\d+\.\d+)') + when: neovim_stats.rc == 0 + +- name: Download neovim {{ neovim.version }} + ansible.builtin.get_url: + url: 'https://github.com/neovim/neovim/releases/download/{{ neovim.version }}/nvim-linux-x86_64.tar.gz' + dest: /tmp/nvim-linux64.tar.gz + mode: '0755' + checksum: '{{ neovim.download_checksum }}' + when: neovim_stats.rc > 0 or neovim_installed_version != neovim.version + register: neovim_download + +- name: Extract downloaded neovim version + ansible.builtin.unarchive: + src: /tmp/nvim-linux64.tar.gz + dest: '{{ neovim.install_path }}' + extra_opts: + - '--strip-components=1' + - '--show-stored-names' + - '--overwrite' + when: | + neovim_download.state == 'file' + and (neovim_installed_version is undefined or neovim_installed_version != neovim.version) + +- name: Add neovim to PATH + become: true + ansible.builtin.template: + src: 'templates/debian/nvim.profile.j2' + dest: '/etc/profile.d/neovim.sh' + mode: '0755' diff --git a/tasks/neovim.yml b/tasks/neovim.yml index 21a3fbf..b647b8d 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -37,22 +37,6 @@ name: neovim global: true -- name: Install language servers - become: true - ansible.builtin.package: - name: '{{ item }}' - state: present - loop: '{{ language_servers | map(attribute="package") | list }}' - when: ansible_facts['os_family'] == 'Archlinux' - -- name: Install language servers on debian hosts - become: true - community.general.npm: - name: '{{ item }}' - global: true - loop: '{{ language_servers | map(attribute="package") | list }}' - when: ansible_facts['os_family'] == 'Debian' - - name: Remove old neovim configuration file ansible.builtin.file: path: '{{ xdg_config_dir }}/nvim/init.vim' @@ -136,57 +120,3 @@ - src: 'templates/nvim/lua/filetype.lua.j2' dest: '{{ xdg_config_dir }}/nvim/lua/_filetype.lua' - -- name: Install neovim from archive - when: ansible_facts['os_family'] == 'Debian' - block: - - name: Create neovim install directory - become: true - ansible.builtin.file: - state: directory - path: '{{ neovim.install_path }}' - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_gid }}' - mode: '0755' - - - name: Register the current neovim version - ansible.builtin.command: - argv: - - '{{ neovim.install_path }}/bin/nvim' - - '--version' - register: neovim_stats - changed_when: false - ignore_errors: true - - - name: Parse the current neovim version - ansible.builtin.set_fact: - neovim_installed_version: neovim_stats.stdout_lines[0] | regex_search('(v\d+\.\d+\.\d+)') - when: neovim_stats.rc == 0 - - - name: Download neovim {{ neovim.version }} - ansible.builtin.get_url: - url: 'https://github.com/neovim/neovim/releases/download/{{ neovim.version }}/nvim-linux-x86_64.tar.gz' - dest: /tmp/nvim-linux64.tar.gz - mode: '0755' - checksum: '{{ neovim.download_checksum }}' - when: neovim_stats.rc > 0 or neovim_installed_version != neovim.version - register: neovim_download - - - name: Extract downloaded neovim version - ansible.builtin.unarchive: - src: /tmp/nvim-linux64.tar.gz - dest: '{{ neovim.install_path }}' - extra_opts: - - '--strip-components=1' - - '--show-stored-names' - - '--overwrite' - when: | - neovim_download.state == 'file' - and (neovim_installed_version is undefined or neovim_installed_version != neovim.version) - - - name: Add neovim to PATH - become: true - ansible.builtin.template: - src: 'templates/nvim.profile.j2' - dest: '/etc/profile.d/neovim.sh' - mode: '0755' diff --git a/templates/nvim.profile.j2 b/templates/debian/nvim.profile.j2 similarity index 100% rename from templates/nvim.profile.j2 rename to templates/debian/nvim.profile.j2 diff --git a/templates/subgid.j2 b/templates/subgid.j2 deleted file mode 100644 index fb08808..0000000 --- a/templates/subgid.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ ansible_user_id }}:231072:65536 diff --git a/templates/subuid.j2 b/templates/subuid.j2 deleted file mode 100644 index fb08808..0000000 --- a/templates/subuid.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ ansible_user_id }}:231072:65536 diff --git a/vars/archlinux.yml b/vars/archlinux.yml deleted file mode 100644 index 74d162d..0000000 --- a/vars/archlinux.yml +++ /dev/null @@ -1,111 +0,0 @@ -ansible_connection: local -ansible_python_interpreter: '/usr/bin/python' - -packages: - - python - - git - - vim - - neovim - - python-pynvim - - wl-clipboard - - npm - - docker - - docker-compose - - iptables-nft - - fuse-overlayfs - - ttf-ibm-plex - - slirp4netns - - tree-sitter - - ripgrep - - uv - -aur_packages: - - url: 'https://aur.archlinux.org/nvm.git' - name: 'nvm' - package_name: 'nvm' - version: '0.40.0-1' - arch: 'any' - -aur_build_dir: '/usr/local/src' -python_build_dir: '/usr/local/src' -python_install_dir: '/opt' - -language_servers: - - package: ansible-language-server - server_name: 'ansiblels' - auto_setup: true - - - package: typescript-language-server - server_name: 'ts_ls' - auto_setup: true - - - package: vscode-json-languageserver - server_name: 'jsonls' - auto_setup: true - - - package: vscode-css-languageserver - server_name: 'cssls' - auto_setup: true - - - package: bash-language-server - server_name: 'bashls' - auto_setup: true - - - package: marksman - server_name: 'marksman' - auto_setup: true - - - package: esbonio - server_name: 'esbonio' - auto_setup: true - - - package: lua-language-server - server_name: 'lua_ls' - auto_setup: true - - - package: yaml-language-server - server_name: 'yamlls' - auto_setup: false - - - package: vscode-html-languageserver - server_name: 'html' - auto_setup: false - - - package: ruff-lsp - server_name: 'ruff' - auto_setup: false - - - package: pyright - server_name: 'pyright' - auto_setup: false - - -python_download_url: 'https://www.python.org/ftp/python' -python_versions: - - version: 3.12.9 - path: 'python3.12' - binary: 'python3.12' - - - version: 3.11.9 - path: 'python3.11' - binary: 'python3.11' - - - version: 3.10.0 - path: 'python3.10' - binary: 'python3.10' - - - version: 3.9.14 - path: 'python3.9' - binary: 'python3.9' - - - version: 3.8.14 - path: 'python3.8' - binary: 'python3.8' - - - version: 3.7.14 - path: 'python3.7' - binary: 'python3.7' - - - version: 3.6.15 - path: 'python3.6' - binary: 'python3.6' diff --git a/vars/main.yml b/vars/main.yml deleted file mode 100644 index ed85251..0000000 --- a/vars/main.yml +++ /dev/null @@ -1,53 +0,0 @@ -ansible_connection: local -ansible_python_interpreter: '/usr/bin/env python' - -xdg_config_dir: '{{ ansible_env.HOME }}/.config' -xdg_data_dir: '{{ ansible_env.HOME }}/.local/share' - -dotfiles_repo: 'git@forgejo.fudiggity.nl:sonny/dotfiles.git' -public_dotfiles_repo: 'https://forgejo.fudiggity.nl/sonny/dotfiles.git' - -neovim_plugins: - - { url: 'https://forgejo.fudiggity.nl/sonny/source-link.lua', name: 'source-link' } - - { url: 'https://github.com/nvim-tree/nvim-tree.lua', name: 'nvim-tree' } - - { - url: 'https://github.com/nvim-tree/nvim-web-devicons', name: 'nvim-tree-icons' - } - - { url: 'https://github.com/neovim/nvim-lspconfig', name: 'nvim-lspconfig' } - - { url: 'https://github.com/hrsh7th/nvim-cmp', name: 'nvim-cmp' } - - { url: 'https://github.com/hrsh7th/cmp-buffer', name: 'cmp-buffer' } - - { url: 'https://github.com/hrsh7th/cmp-path', name: 'cmp-path' } - - { url: 'https://github.com/hrsh7th/cmp-omni', name: 'cmp-omni' } - - { url: 'https://github.com/hrsh7th/cmp-nvim-lsp', name: 'cmp-nvim-lsp' } - - { url: 'https://github.com/hrsh7th/cmp-nvim-lua', name: 'cmp-nvim-lua' } - - { url: 'https://github.com/nvim-treesitter/nvim-treesitter', name: 'nvim-treesitter' } - - { url: 'https://github.com/nvim-lua/plenary.nvim', name: 'plenary.nvim' } - - { - url: 'https://github.com/nvim-telescope/telescope-fzf-native.nvim', - name: 'telescope-fzf-native.nvim', - } - - { - url: 'https://github.com/nvim-telescope/telescope.nvim', - name: 'telescope.nvim', - version: '0.1.x', - } - - { url: 'https://github.com/L3MON4D3/LuaSnip', name: 'luasnip', version: 'v1.0.0' } - - { - url: 'https://github.com/lewis6991/gitsigns.nvim', - name: 'gitsigns.nvim', - version: 'v0.9.0', - } - - { url: 'https://github.com/nvim-lualine/lualine.nvim', name: 'lualine' } - - { - url: 'https://github.com/lukas-reineke/indent-blankline.nvim', - name: 'indent-blankline.nvim', - version: 'v3.7.2', - } - - { - url: 'https://github.com/projekt0n/github-nvim-theme.git', - name: 'github-colors', - version: 'v1.1.2', - } - -git_domain: 'forgejo.fudiggity.nl' -git_host_key: 'forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+'