--- - name: Install packages (Archlinux) become: true pacman: name: - vim - python-pynvim - neovim - python-pylint - python-black - ansible-lint - base-devel - flake8 - mypy - shellcheck - cmake - clang - npm when: ansible_facts['distribution'] == 'Archlinux' - name: Install packages (Debian) become: true apt: name: - vim - python3-pynvim - neovim - build-essential - python3-dev - pylint3 - ansible-lint - flake8 - mypy - shellcheck - cmake - clang - npm when: ansible_facts['distribution'] == 'Debian' # some Arch derivatives don't have the shellcheck package (arch32, archarm) - name: Run shellcheck script script: scripts/shellcheck_binary_fix.sh register: shellcheck_script when: ansible_facts['distribution'] == 'Archlinux' changed_when: "'there is nothing to do' not in shellcheck_script.stdout" - name: Install neovim with pip for Debian pip: name: neovim extra_args: --user when: ansible_facts['distribution'] == 'Debian' - name: Install neovim-remote pip: name: neovim-remote extra_args: --user - name: Make sure needed directories exist file: path={{ item.path }} state=directory mode={{ item.mode }} with_items: - {path: '~/.vim', mode: '0755'} - {path: '~/.vim/autoload', mode: '0750'} - {path: '~/.config/nvim', mode: '0755'} - name: Check if colors is a symlink stat: path: ~/.vim/colors follow: false register: colors_dir - name: Remove colors symlink file: path: ~/.vim/colors state: absent when: colors_dir.stat.exists and colors_dir.stat.islnk - name: Copy configs copy: src={{ item.src }} dest={{ item.dest }} mode=0644 with_items: - {src: 'init.vim', dest: '~/.config/nvim/init.vim'} - {src: 'flake8', dest: '~/.flake8'} - {src: 'pylintrc', dest: '~/.pylintrc'} - {src: 'vimrc', dest: '~/.vimrc'} - {src: 'colors', dest: '~/.vim/'} - name: Check if vim-plug is installed stat: path: ~/.vim/autoload/plug.vim register: vimplug - name: Install vim-plug get_url: url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim dest: ~/.vim/autoload/plug.vim mode: 0644 when: not vimplug.stat.exists - name: Upgrade vim-plug command: cmd: vim +PlugUpgrade +qall stdin: '\n' # On error needs user input to continue register: result changed_when: "'vim-plug is already up-to-date' not in result.stdout" - name: Install plugins command: cmd: vim +PlugInstall +qall stdin: '\n' # On error needs user input to continue register: result changed_when: "'Resolving deltas' in result.stdout" - name: Update plugins command: cmd: vim +PlugUpdate +qall stdin: '\n' # On error needs user input to continue register: result changed_when: "'files changed' in result.stdout" - name: Update Coc plugins command: cmd: vim +CocUpdate +qall stdin: '\n' # On error needs user input to continue register: result changed_when: "'Updated' in result.stdout" - name: Upgrade Black command: cmd: vim +BlackUpgrade +qall stdin: '\n' # On error needs user input to continue register: result # TODO: changed_when - name: Install hdl-checker pip: name: hdl-checker extra_args: --user register: result changed_when: "'Running setup.py install for hdl-checker' in result.stdout"