summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2016-02-24 08:39:53 -0500
committerBrian Coca <brian.coca+git@gmail.com>2016-02-24 08:40:33 -0500
commitfade5b7936342bd289e20da7413617780bb330b6 (patch)
tree18dabd7af3908ad4bf4846690859549b233bec92 /files
parent7894c2efdd2180025e257328e45171f0165923c1 (diff)
downloadansible-modules-extras-fade5b7936342bd289e20da7413617780bb330b6.tar.gz
added docs to blockinfile with_ interactions
fixes #1592
Diffstat (limited to 'files')
-rw-r--r--files/blockinfile.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/files/blockinfile.py b/files/blockinfile.py
index a40f57a8..c2e449b2 100644
--- a/files/blockinfile.py
+++ b/files/blockinfile.py
@@ -38,6 +38,7 @@ description:
surrounded by customizable marker lines.
notes:
- This module supports check mode.
+ - When using 'with_' loops be aware that if you do not set a unique mark the block will be overwritten on each iteration.
options:
dest:
aliases: [ name, destfile ]
@@ -136,6 +137,17 @@ EXAMPLES = r"""
dest: /var/www/html/index.html
marker: "<!-- {mark} ANSIBLE MANAGED BLOCK -->"
content: ""
+
+- name: insert/update "Match User" configuation block in /etc/ssh/sshd_config
+ blockinfile:
+ dest: /etc/hosts
+ block: |
+ {{item.name}} {{item.ip}}
+ marker: "# {mark} ANSIBLE MANAGED BLOCK {{item.name}}"
+ with_items:
+ - { name: host1, ip: 10.10.1.10 }
+ - { name: host2, ip: 10.10.1.11 }
+ - { name: host3, ip: 10.10.1.12 }
"""