ansible-role-blockinfile
ansible-role-blockinfile copied to clipboard
Handling escape sequence in ansible 1.7
The following code block:
if present and block:
# Escape seqeuences like '\n' need to be handled in Ansible 1.x
if ANSIBLE_VERSION.startswith('1.'):
block = re.sub('', block, '')
blocklines = [marker0] + block.splitlines() + [marker1]
will crash under my test system with Ansible 1.7.
ANSIBLE_VERSION is not found and throws a NameError; my guess is that a newer version of ansible will import ANSIBE_VERSION with the wildcard imports but an older version does not. The program seems to work after removing the entire if block.