diff --git a/install_nvim.yaml b/install_nvim.yaml new file mode 100644 index 0000000..48a5556 --- /dev/null +++ b/install_nvim.yaml @@ -0,0 +1,103 @@ +--- +- name: Installing Nvim + hosts: 192.168.1.25 + + tasks: + - name: Pulling from github + ansible.builtin.command: + cmd: "curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz" + + - name: Removing and older verson + become: true + ansible.builtin.command: + cmd: "rm -rf /opt/nvim" + + - name: Unziping Nvim + become: true + ansible.builtin.command: + cmd: "tar -C /opt -xzf nvim-linux64.tar.gz" + + - name: Setting the path + ansible.builtin.lineinfile: + line: 'export PATH="$PATH:/opt/nvim-linux64/bin"' + path: "~/.bashrc" + insertafter: EOF + + - name: Check if there is a config + ansible.builtin.stat: + path: ~/.config/nvim + register: nvim_config + + - name: Checking if there is a backup Nvim config + ansible.builtin.stat: + path: ~/.config/nvim.bak + register: nvim_backup_config + + - name: Removing backup config + ansible.builtin.command: + cmd: "rm -r ~/.config/nvim.bak" + when: nvim_backup_config.stat.exists + + - name: Backup configs + ansible.builtin.command: + cmd: "mv ~/.config/nvim ~/.config/nvim.bak" + when: nvim_config.stat.exists + + - name: Pulling config + ansible.builtin.command: + cmd: "git clone https://github.com/LazyVim/starter ~/.config/nvim" + + - name: removing the git file + ansible.builtin.command: + cmd: "rm -rf ~/.config/nvim/.git" + + - name: Cleanup + ansible.builtin.command: + cmd: "rm ~/nvim-linux64.tar.gz" + + - name: installing unzip + become: true + when: ansible_pkg_mgr == "apt" + ansible.builtin.apt: + name: unzip + state: latest + + - name: Check if Font folder is there + ansible.builtin.stat: + path: ~/.local/share/fonts + register: fonts_folder + + - name: Making font folder + ansible.builtin.command: + cmd: "mkdir ~/.local/share/fonts" + when: fonts_folder.stat.exists != True + + - name: Nerd font zip + ansible.builtin.command: + cmd: "wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/3270.zip" + + - name: Unzipping + ansible.builtin.command: + cmd: "unzip 3270.zip -d ~/.local/share/fonts/ " + + - name: Font Cleanup + ansible.builtin.command: + cmd: "rm ~/3270.zip" + + - name: installing font config + become: true + when: ansible_pkg_mgr == "apt" + ansible.builtin.apt: + name: fontconfig + state: latest + + - name: Set Fonts + ansible.builtin.command: + cmd: "fc-cache -fv" + + - name: installing fzf for nvim + become: true + when: ansible_pkg_mgr == "apt" + ansible.builtin.apt: + name: fzf + state: latest