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
Post a Comment