Ansible-playbook: how to write content of var to file -


i have var, want write content of var line in file.

example: var: text_need_to_add

file before added:
some_line
text text mark text text
some_line

file after added:
some_line
text text mark text_need_to_add text text
some_line

what should do?
sorry english.

you can magic sed command:

- name: insert string in file   shell: sed '/mark/a {{ text_need_to_add }}' filename 

i'm not in sed manipulation, general idea is: if can't ansible, try in bash , if - setup ansible you. or can write ansible module it, bash enough.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -