|
|
|
@ -18,10 +18,6 @@
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import os
|
|
|
|
|
import tempfile
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = """
|
|
|
|
|
---
|
|
|
|
|
module: blockinfile
|
|
|
|
@ -150,6 +146,12 @@ EXAMPLES = r"""
|
|
|
|
|
- { name: host3, ip: 10.10.1.12 }
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import os
|
|
|
|
|
import tempfile
|
|
|
|
|
|
|
|
|
|
from ansible import __version__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def write_changes(module, contents, dest):
|
|
|
|
|
|
|
|
|
@ -244,7 +246,7 @@ def main():
|
|
|
|
|
marker1 = re.sub(r'{mark}', 'END', marker)
|
|
|
|
|
if present and block:
|
|
|
|
|
# Escape seqeuences like '\n' need to be handled in Ansible 1.x
|
|
|
|
|
if ANSIBLE_VERSION.startswith('1.'):
|
|
|
|
|
if __version__.startswith('1.'):
|
|
|
|
|
block = re.sub('', block, '')
|
|
|
|
|
blocklines = [marker0] + block.splitlines() + [marker1]
|
|
|
|
|
else:
|
|
|
|
|