Answer the question
In order to leave comments, you need to log in
How to replace a word in ansible module lineinfile instead of the whole line?
I want to replace true with false using ansible in the config file.
Through the shell module using sed there are no problems, but through lineinfile I can only edit by replacing the entire line, I want only one word to be replaced, how to do it?
shell:
- name: edit
shell: sed -i "/login-users/ s|true|false|" /opt/templ.xml
- name: edit
lineinfile:
dest: /opt/templ.xml
regexp: login-users
line: <loginusers>false</login-users>
backrefs: yes
state: present
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question