Ansible lineinfile duplicates lines -


 - vars:    npm:       npm_global: "{{ ansible_env.home }}/.npm-global"   - name: update bashrc npm    lineinfile: >    dest={{ project.shell_rc_file }}    regexp='export path={{ npm.npm_global }}/bin:$path'    line='export path={{ npm.npm_global }}/bin:$path'    state=present    backup=yes    create=yes 

i tried many times duplicates line in export path=...

you need escape \$ in regexp parameter since $ in regex means end of line. regex never matched since there can't string path after end of line.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -