Make unchanged tasks in vim role not report changed

This commit is contained in:
flyingscorpio@clevo 2022-03-11 20:06:39 +01:00
parent d845af7949
commit d800e77ac7

View file

@ -38,11 +38,17 @@
when: ansible_facts['distribution'] == 'Archlinux'
changed_when: "'there is nothing to do' not in shellcheck_script.stdout"
- name: Remove ~/.vim/colors/ directory
- 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
changed_when: false
when: colors_dir.stat.exists and colors_dir.stat.islnk
- name: Copy configs
copy: src={{ item.src }} dest={{ item.dest }}
@ -50,7 +56,7 @@
- { src: 'flake8', dest: '~/.flake8' }
- { src: 'pylintrc', dest: '~/.pylintrc' }
- { src: 'vimrc', dest: '~/.vimrc' }
- { src: 'colors/', dest: '~/.vim/colors/' }
- { src: 'colors', dest: '~/.vim/' }
- name: Check if vim-plug is installed
stat:
@ -65,28 +71,39 @@
command:
cmd: vim +PlugUpgrade +qall
stdin: '\n' # When an error with vimrc is encountered, 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' # When an error with vimrc is encountered, needs user input to continue
register: result
changed_when: "'Resolving deltas' in result.stdout"
- name: Update plugins
command:
cmd: vim +PlugUpdate +qall
stdin: '\n' # When an error with vimrc is encountered, 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' # When an error with vimrc is encountered, needs user input to continue
register: result
changed_when: "'Updated' in result.stdout"
- name: Upgrade Black
command:
cmd: vim +BlackUpgrade +qall
stdin: '\n' # When an error with vimrc is encountered, needs user input to continue
register: result
- 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"