diff --git a/group_vars/all/git.yml b/group_vars/all/git.yml index 4715cd3..b44e7e1 100644 --- a/group_vars/all/git.yml +++ b/group_vars/all/git.yml @@ -1,7 +1,8 @@ -dotfiles_repo: 'git@forgejo.fudiggity.nl:sonny/dotfiles.git' +--- +dotfiles_repo: "git@forgejo.fudiggity.nl:sonny/dotfiles.git" -git_domain: 'forgejo.fudiggity.nl' -git_host_key: 'forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+' +git_domain: "forgejo.fudiggity.nl" +git_host_key: "forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+" git_name: Sonny Bakker git_email: sonny871@hotmail.com diff --git a/group_vars/all/neovim.yml b/group_vars/all/neovim.yml index e67edd3..767a4b7 100644 --- a/group_vars/all/neovim.yml +++ b/group_vars/all/neovim.yml @@ -1,50 +1,51 @@ +--- 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://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" version: master # main seems broken? - - 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' - - url: 'https://github.com/stevearc/conform.nvim.git' - name: 'conform.nvim' - version: 'v9.0.0' + - 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" + - url: "https://github.com/stevearc/conform.nvim.git" + name: "conform.nvim" + version: "v9.0.0" language_servers: [] diff --git a/group_vars/all/system.yml b/group_vars/all/system.yml index f57d500..d056de1 100644 --- a/group_vars/all/system.yml +++ b/group_vars/all/system.yml @@ -1,4 +1,5 @@ -xdg_config_dir: '{{ ansible_env.HOME }}/.config' -xdg_data_dir: '{{ ansible_env.HOME }}/.local/share' +--- +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 index 6f1c646..a14af3d 100644 --- a/group_vars/arch/aur.yml +++ b/group_vars/arch/aur.yml @@ -1,40 +1,41 @@ +--- aur_packages: - - url: 'https://aur.archlinux.org/nvm.git' - name: 'nvm' - package_name: 'nvm' - version: '0.40.0-1' - arch: 'any' + - 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' +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_download_url: "https://www.python.org/ftp/python" python_versions: - version: 3.12.9 - path: 'python3.12' - binary: 'python3.12' + path: "python3.12" + binary: "python3.12" - version: 3.11.9 - path: 'python3.11' - binary: 'python3.11' + path: "python3.11" + binary: "python3.11" - version: 3.10.0 - path: 'python3.10' - binary: 'python3.10' + path: "python3.10" + binary: "python3.10" - version: 3.9.14 - path: 'python3.9' - binary: 'python3.9' + path: "python3.9" + binary: "python3.9" - version: 3.8.14 - path: 'python3.8' - binary: 'python3.8' + path: "python3.8" + binary: "python3.8" - version: 3.7.14 - path: 'python3.7' - binary: 'python3.7' + path: "python3.7" + binary: "python3.7" - version: 3.6.15 - path: 'python3.6' - binary: 'python3.6' + path: "python3.6" + binary: "python3.6" diff --git a/group_vars/arch/neovim.yml b/group_vars/arch/neovim.yml index 16b1284..debc75b 100644 --- a/group_vars/arch/neovim.yml +++ b/group_vars/arch/neovim.yml @@ -1,3 +1,4 @@ +--- language_servers: - package: ansible-language-server server_name: "ansiblels" diff --git a/group_vars/arch/system.yml b/group_vars/arch/system.yml index 3bab5fb..0d2feef 100644 --- a/group_vars/arch/system.yml +++ b/group_vars/arch/system.yml @@ -1,3 +1,4 @@ +--- packages: - python - git diff --git a/group_vars/debian/neovim.yml b/group_vars/debian/neovim.yml index af2c892..cb53eb6 100644 --- a/group_vars/debian/neovim.yml +++ b/group_vars/debian/neovim.yml @@ -1,3 +1,4 @@ +--- # TODO: add lua language server, see https://github.com/LuaLS/lua-language-server? language_servers: - package: "@ansible/ansible-language-server" diff --git a/group_vars/debian/system.yml b/group_vars/debian/system.yml index 56be4aa..2660131 100644 --- a/group_vars/debian/system.yml +++ b/group_vars/debian/system.yml @@ -1,3 +1,4 @@ +--- packages: - python3 - git diff --git a/inventory.yml b/inventory.yml index 7ebdbcf..5f1897f 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,3 +1,4 @@ +--- personal: hosts: xps: &xps @@ -16,7 +17,6 @@ debian: hosts: fudiggity: <<: *fudiggity - arch: hosts: xps: diff --git a/playbook.yml b/playbook.yml index 8ab70f7..3a63d77 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,3 +1,4 @@ +--- - name: Development provisioning hosts: - personal @@ -6,38 +7,38 @@ pre_tasks: - name: Verifying that a limit is set ansible.builtin.fail: - msg: 'This playbook cannot be run with no limit' + 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 }}' + name: "{{ item }}" state: present - loop: '{{ packages }}' + loop: "{{ packages }}" - name: Add git forge to known hosts ansible.builtin.include_role: name: common - tasks_from: 'known_hosts.yml' + tasks_from: "known_hosts.yml" vars: - user: '{{ ansible_user_id }}' + user: "{{ ansible_user_id }}" items: - - domain: '{{ git_domain }}' - key: '{{ git_host_key }}' + - domain: "{{ git_domain }}" + key: "{{ git_host_key }}" when: ansible_hostname != 'fudiggity' tasks: - name: Setup dotfiles - ansible.builtin.import_tasks: 'tasks/dotfiles.yml' + ansible.builtin.import_tasks: "tasks/dotfiles.yml" tags: dotfiles - name: Include generic neovim tasks - ansible.builtin.import_tasks: 'tasks/neovim.yml' + ansible.builtin.import_tasks: "tasks/neovim.yml" tags: neovim - name: Include debian neovim tasks - ansible.builtin.import_tasks: 'tasks/debian/neovim.yml' + ansible.builtin.import_tasks: "tasks/debian/neovim.yml" when: "'debian' in group_names" tags: neovim @@ -49,23 +50,23 @@ manager: pacman - name: Include arch neovim tasks - ansible.builtin.import_tasks: 'tasks/arch/neovim.yml' + 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' + ansible.builtin.import_tasks: "tasks/arch/aur.yml" tags: aur - name: Setup docker - ansible.builtin.import_tasks: 'tasks/arch/docker.yml' + 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 }}' + ansible.builtin.include_tasks: "tasks/arch/python.yml" + loop: "{{ python_versions }}" tags: python - name: Setup NVM - ansible.builtin.import_tasks: 'tasks/arch/nvm.yml' + ansible.builtin.import_tasks: "tasks/arch/nvm.yml" tags: nvm diff --git a/requirements.yml b/requirements.yml index b20eeb6..7a0710c 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,3 +1,4 @@ +--- - src: git+https://forgejo.fudiggity.nl/sonny/common-ansible.git name: common version: master diff --git a/tasks/arch/aur-package.yml b/tasks/arch/aur-package.yml index e00f8ab..8955b63 100644 --- a/tasks/arch/aur-package.yml +++ b/tasks/arch/aur-package.yml @@ -1,9 +1,10 @@ +--- - name: Set package directory ansible.builtin.set_fact: - build_dir: '{{ aur_build_dir }}/{{ item.name }}' + build_dir: "{{ aur_build_dir }}/{{ item.name }}" -- name: 'Retrieve package name for {{ item.name }}' - command: +- name: "Retrieve package name for {{ item.name }}" + ansible.builtin.command: argv: - grep - --only-matching @@ -12,8 +13,8 @@ - "{{ build_dir }}/PKGBUILD" register: pkg_name -- name: 'Retrieve package version for {{ item.name }}' - command: +- name: "Retrieve package version for {{ item.name }}" + ansible.builtin.command: argv: - grep - --only-matching @@ -22,8 +23,8 @@ - "{{ build_dir }}/PKGBUILD" register: pkg_version -- name: 'Retrieve package release for {{ item.name }}' - command: +- name: "Retrieve package release for {{ item.name }}" + ansible.builtin.command: argv: - grep - --only-matching @@ -34,20 +35,20 @@ - 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' + 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 }}' - ansible.builtin.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 }}' + 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 community.general.pacman: - name: '{{ build_dir }}/{{ package_filename }}' + name: "{{ build_dir }}/{{ package_filename }}" state: present when: item.version != installed_version diff --git a/tasks/arch/aur.yml b/tasks/arch/aur.yml index e31aab7..14ce325 100644 --- a/tasks/arch/aur.yml +++ b/tasks/arch/aur.yml @@ -1,26 +1,27 @@ +--- - name: Retrieve directory stats ansible.builtin.stat: - path: '{{ aur_build_dir }}/{{ item.name }}' - loop: '{{ aur_packages }}' + path: "{{ aur_build_dir }}/{{ item.name }}" + loop: "{{ aur_packages }}" - name: Clone aur packages become: true ansible.builtin.git: - repo: '{{ item.url }}' - dest: '{{ aur_build_dir }}/{{ item.name }}' + repo: "{{ item.url }}" + dest: "{{ aur_build_dir }}/{{ item.name }}" update: true - loop: '{{ aur_packages }}' + loop: "{{ aur_packages }}" - name: Change aur package directories owner become: true ansible.builtin.file: - path: '{{ aur_build_dir }}/{{ item.name }}' + path: "{{ aur_build_dir }}/{{ item.name }}" state: directory - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_id }}' + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_id }}" recurse: true - loop: '{{ aur_packages }}' + loop: "{{ aur_packages }}" - name: Build & install aur packages - ansible.builtin.include_tasks: 'tasks/arch/aur-package.yml' - loop: '{{ aur_packages }}' + ansible.builtin.include_tasks: "tasks/arch/aur-package.yml" + loop: "{{ aur_packages }}" diff --git a/tasks/arch/docker.yml b/tasks/arch/docker.yml index c68a81f..fa96d20 100644 --- a/tasks/arch/docker.yml +++ b/tasks/arch/docker.yml @@ -1,7 +1,8 @@ +--- - name: Remove docker mapping files become: true ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: absent loop: - /etc/subgid @@ -10,38 +11,38 @@ - name: Setup desktop configuration become: true ansible.builtin.file: - path: 'files/desktop/docker-daemon.json' - dest: '/etc/docker/daemon.json' - mode: '0755' + path: "files/desktop/docker-daemon.json" + dest: "/etc/docker/daemon.json" + mode: "0755" when: ansible_hostname == 'desktop' - name: Remove user setup desktop configuration ansible.builtin.file: - path: '{{ xdg_config_dir }}/docker/daemon.json' + path: "{{ xdg_config_dir }}/docker/daemon.json" state: absent when: ansible_hostname == 'desktop' - name: Check for .bashrc.override ansible.builtin.stat: - path: '{{ ansible_env.HOME }}/.bashrc.override' + path: "{{ ansible_env.HOME }}/.bashrc.override" register: bashrc_override - name: Create .bashrc.override ansible.builtin.file: - path: '{{ ansible_env.HOME }}/.bashrc.override' + path: "{{ ansible_env.HOME }}/.bashrc.override" state: touch - mode: '0755' + mode: "0755" when: not bashrc_override.stat.exists - name: Remove rootless DOCKER_HOST variable assignment ansible.builtin.lineinfile: - path: '{{ ansible_env.HOME }}/.bashrc.override' - regexp: '^export DOCKER_HOST=' - line: '' + path: "{{ ansible_env.HOME }}/.bashrc.override" + regexp: "^export DOCKER_HOST=" + line: "" - name: Disable user docker socket ansible.builtin.systemd: - name: '{{ item }}' + name: "{{ item }}" state: stopped enabled: false scope: user diff --git a/tasks/arch/neovim.yml b/tasks/arch/neovim.yml index 0cccfa1..6851bbb 100644 --- a/tasks/arch/neovim.yml +++ b/tasks/arch/neovim.yml @@ -1,6 +1,7 @@ +--- - name: Install language servers become: true community.general.pacman: - name: '{{ item }}' + name: "{{ item }}" state: present loop: '{{ language_servers | map(attribute="package") | list }}' diff --git a/tasks/arch/nvm.yml b/tasks/arch/nvm.yml index b2f2e36..2a29236 100644 --- a/tasks/arch/nvm.yml +++ b/tasks/arch/nvm.yml @@ -1,15 +1,16 @@ +--- - name: Set NVM install directory ansible.builtin.set_fact: - install_dir: '{{ xdg_config_dir }}/nvm' + install_dir: "{{ xdg_config_dir }}/nvm" - name: Remove manually installed nvm install directory ansible.builtin.file: - path: '{{ install_dir }}' + path: "{{ install_dir }}" state: absent - name: Remove nvm entry from bashrc ansible.builtin.lineinfile: - path: '{{ ansible_env.HOME }}/.bashrc.override' + path: "{{ ansible_env.HOME }}/.bashrc.override" line: > [ -s "{{ install_dir }}/nvm.sh" ] && \. "{{ install_dir }}/nvm.sh" # This loads nvm state: absent diff --git a/tasks/arch/python.yml b/tasks/arch/python.yml index 72bfbff..ddc6fb4 100644 --- a/tasks/arch/python.yml +++ b/tasks/arch/python.yml @@ -1,65 +1,66 @@ -- name: 'check for {{ item.binary }} binary' - command: 'which {{ item.binary }}' +--- +- name: "Check for {{ item.binary }} binary" + ansible.builtin.command: "which {{ item.binary }}" changed_when: false failed_when: python_installed.rc not in [ 0, 1 ] register: python_installed -- name: 'check for {{ item.binary }} download' - stat: - path: '{{ python_build_dir }}/python-{{ item.version }}.tgz' +- name: "Check for {{ item.binary }} download" + ansible.builtin.stat: + path: "{{ python_build_dir }}/python-{{ item.version }}.tgz" register: python_download -- block: +- when: python_installed.rc not in [ 0 ] + block: # TODO: verify for checksum - - name: 'retrieve python {{ item.version }} source' + - name: "Retrieve python {{ item.version }} source" become: true - get_url: - url: '{{ python_download_url }}/{{ item.version }}/Python-{{ item.version }}.tgz' - dest: '{{ python_build_dir }}/python-{{ item.version }}.tgz' - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_id }}' + ansible.builtin.get_url: + url: "{{ python_download_url }}/{{ item.version }}/Python-{{ item.version }}.tgz" + dest: "{{ python_build_dir }}/python-{{ item.version }}.tgz" + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_id }}" when: not python_download.stat.exists - - name: 'extract python {{ item.version }} sources' + - name: "Extract python {{ item.version }} sources" become: true - unarchive: - src: '{{ python_build_dir }}/python-{{ item.version }}.tgz' - dest: '{{ python_build_dir }}' - include: 'Python-{{ item.version }}' + ansible.builtin.unarchive: + src: "{{ python_build_dir }}/python-{{ item.version }}.tgz" + dest: "{{ python_build_dir }}" + include: "Python-{{ item.version }}" - - name: rename source directory + - name: Rename source directory become: true - ansible.builtin.command: 'mv {{ python_build_dir}}/Python-{{ item.version }} {{ python_build_dir }}/{{ item.path }}' + ansible.builtin.command: "mv {{ python_build_dir}}/Python-{{ item.version }} {{ python_build_dir }}/{{ item.path }}" - - name: set correct permissions + - name: Set correct permissions become: true - file: - path: '{{ python_build_dir }}/{{ item.path }}' + ansible.builtin.file: + path: "{{ python_build_dir }}/{{ item.path }}" recurse: true - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_id }}' + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_id }}" state: directory - - name: configure build - ansible.builtin.command: 'sh ./configure --prefix={{ python_install_dir }}/{{ item.path }}' + - name: Configure build + ansible.builtin.command: "sh ./configure --prefix={{ python_install_dir }}/{{ item.path }}" args: - chdir: '{{ python_build_dir }}/{{ item.path }}/' + chdir: "{{ python_build_dir }}/{{ item.path }}/" - - name: make build - ansible.builtin.command: 'make' + - name: Make build + ansible.builtin.command: "make" args: - chdir: '{{ python_build_dir }}/{{ item.path }}/' + chdir: "{{ python_build_dir }}/{{ item.path }}/" - - name: install build + - name: Install build become: true - ansible.builtin.command: 'make install' + ansible.builtin.command: "make install" args: - chdir: '{{ python_build_dir }}/{{ item.path }}/' + chdir: "{{ python_build_dir }}/{{ item.path }}/" - - name: 'create symlink for python {{ item.version }}' + - name: "Create symlink for python {{ item.version }}" become: true - file: - src: '{{ python_install_dir }}/{{ item.path }}/bin/{{ item.binary }}' - dest: '/usr/bin/{{ item.binary }}' + ansible.builtin.file: + src: "{{ python_install_dir }}/{{ item.path }}/bin/{{ item.binary }}" + dest: "/usr/bin/{{ item.binary }}" state: link - when: python_installed.rc not in [ 0 ] diff --git a/tasks/debian/neovim.yml b/tasks/debian/neovim.yml index 939a741..a9cd4b4 100644 --- a/tasks/debian/neovim.yml +++ b/tasks/debian/neovim.yml @@ -1,7 +1,8 @@ +--- - name: Install language servers on debian hosts become: true community.general.npm: - name: '{{ item }}' + name: "{{ item }}" global: true loop: '{{ language_servers | map(attribute="package") | list }}' @@ -9,16 +10,16 @@ become: true ansible.builtin.file: state: directory - path: '{{ neovim.install_path }}' - owner: '{{ ansible_user_id }}' - group: '{{ ansible_user_gid }}' - mode: '0755' + 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' + - "{{ neovim.install_path }}/bin/nvim" + - "--version" register: neovim_stats changed_when: false ignore_errors: true @@ -30,21 +31,21 @@ - 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' + 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 }}' + 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 }}' + dest: "{{ neovim.install_path }}" extra_opts: - - '--strip-components=1' - - '--show-stored-names' - - '--overwrite' + - "--strip-components=1" + - "--show-stored-names" + - "--overwrite" when: | neovim_download.state == 'file' and (neovim_installed_version is undefined or neovim_installed_version != neovim.version) @@ -52,6 +53,6 @@ - name: Add neovim to PATH become: true ansible.builtin.template: - src: 'templates/debian/nvim.profile.j2' - dest: '/etc/profile.d/neovim.sh' - mode: '0755' + src: "templates/debian/nvim.profile.j2" + dest: "/etc/profile.d/neovim.sh" + mode: "0755" diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index b8c40e6..470bda9 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -1,69 +1,70 @@ +--- - name: Clone dotfiles ansible.builtin.git: - repo: '{{ dotfiles_repo }}' - dest: '{{ ansible_env.HOME }}/dotfiles' + repo: "{{ dotfiles_repo }}" + dest: "{{ ansible_env.HOME }}/dotfiles" version: master update: true - name: Create xdg configuration directories ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: directory - mode: '0755' + mode: "0755" loop: - - '{{ xdg_config_dir }}/git' - - '{{ xdg_config_dir }}/tmux' + - "{{ xdg_config_dir }}/git" + - "{{ xdg_config_dir }}/tmux" - name: Remove previous dotfiles ansible.builtin.file: - path: '{{ item }}' + path: "{{ item }}" state: absent loop: - - '{{ ansible_env.HOME }}/.tmux.conf' - - '{{ ansible_env.HOME }}/.gitconfig' + - "{{ ansible_env.HOME }}/.tmux.conf" + - "{{ ansible_env.HOME }}/.gitconfig" - name: Setup dotfiles ansible.builtin.file: - path: '{{ item.dest }}' - src: '{{ item.src }}' + path: "{{ item.dest }}" + src: "{{ item.src }}" state: link force: true loop: - - src: '{{ ansible_env.HOME }}/dotfiles/.vimrc' - dest: '{{ ansible_env.HOME }}/.vimrc' + - src: "{{ ansible_env.HOME }}/dotfiles/.vimrc" + dest: "{{ ansible_env.HOME }}/.vimrc" - - src: '{{ ansible_env.HOME }}/dotfiles/.bashrc' - dest: '{{ ansible_env.HOME }}/.bashrc' + - src: "{{ ansible_env.HOME }}/dotfiles/.bashrc" + dest: "{{ ansible_env.HOME }}/.bashrc" - - src: '{{ ansible_env.HOME }}/dotfiles/.profile' - dest: '{{ ansible_env.HOME }}/.profile' + - src: "{{ ansible_env.HOME }}/dotfiles/.profile" + dest: "{{ ansible_env.HOME }}/.profile" - - src: '{{ ansible_env.HOME }}/dotfiles/tmux/tmux.conf' - dest: '{{ xdg_config_dir }}/tmux/tmux.conf' + - src: "{{ ansible_env.HOME }}/dotfiles/tmux/tmux.conf" + dest: "{{ xdg_config_dir }}/tmux/tmux.conf" - - src: '{{ ansible_env.HOME }}/dotfiles/tmux/light.conf' - dest: '{{ xdg_config_dir }}/tmux/light.conf' + - src: "{{ ansible_env.HOME }}/dotfiles/tmux/light.conf" + dest: "{{ xdg_config_dir }}/tmux/light.conf" - - src: '{{ ansible_env.HOME }}/dotfiles/tmux/dark.conf' - dest: '{{ xdg_config_dir }}/tmux/dark.conf' + - src: "{{ ansible_env.HOME }}/dotfiles/tmux/dark.conf" + dest: "{{ xdg_config_dir }}/tmux/dark.conf" - - src: '{{ ansible_env.HOME }}/dotfiles/.gitignore' - dest: '{{ xdg_config_dir }}/git/ignore' + - src: "{{ ansible_env.HOME }}/dotfiles/.gitignore" + dest: "{{ xdg_config_dir }}/git/ignore" - name: Copy git configuration ansible.builtin.template: - src: 'templates/gitconfig.j2' - dest: '{{ xdg_config_dir }}/git/config' - mode: '0755' + src: "templates/gitconfig.j2" + dest: "{{ xdg_config_dir }}/git/config" + mode: "0755" - name: Create script directory ansible.builtin.file: - path: '{{ ansible_env.HOME }}/.local/bin' + path: "{{ ansible_env.HOME }}/.local/bin" state: directory - mode: '0755' + mode: "0755" - name: Copy tmux toggle script ansible.builtin.template: - src: 'templates/tmux-toggle.j2' - dest: '{{ ansible_env.HOME }}/.local/bin/tmux-toggle.sh' - mode: '0755' + src: "templates/tmux-toggle.j2" + dest: "{{ ansible_env.HOME }}/.local/bin/tmux-toggle.sh" + mode: "0755" diff --git a/tasks/neovim.yml b/tasks/neovim.yml index 6bdbe68..3303d3a 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -1,3 +1,4 @@ +--- - name: Ensure neovim configuration directories exist ansible.builtin.file: path: "{{ item }}"