This article was originally published on bmf-tech.com.
Overview
A task to write to remote files using Ansible. Frequently used.
Playbook
---
- hosts: vps
become: yes
user: root
tasks:
- name: Add text
blockinfile:
dest: /path/to/file
insertafter: '^# Add Here'
content: |
# New Line
Here is a new line.
Thoughts
It's easy to write.
Top comments (0)