Hello
I want to change the configuration of vim, in order to do set mouse=r.
At the beginning this line is commented by default. Using inlinefile module, I check by regexp the line commented and I replace it with the new line like this:
- name: Uncommenting mouse=a in /etc/vim/vimrc
lineinfile:
path: /etc/vim/vimrc
regexp: '^"set mouse=a'
line: 'set mouse=r'
First runs is okay, but the second run ansible append another line to the file like this:
TASK [cassandra_preinstall : Uncommenting mouse=a in /etc/vim/vimrc] ***************************************************************************************************************************************
--- before: /etc/vim/vimrc (content)
+++ after: /etc/vim/vimrc (content)
@@ -56,3 +56,4 @@
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
+set mouse=r
It is like lineinfile does not care about the regexp result that should be empty.
What I am missing ?