Skip to content

Commit 57f84ca

Browse files
andrewhowdencomfreemanjp
authored andcommitted
Added support for multiline ansible_managed (#32)
In the project in which this is being implemented, the ansible_managed phrase spans over multiple lines. It explains that changes will not be persisted, and where to find the ansible repository. However, in the case of the templates generated here, the comment is only applied to the first line of ansible managed. Accordingly, it introduces various syntax errors, particularly in `/etc/profile.d/`. This commmit uses the `comment` filter, introduced with Ansible, to prefix all lines with a `#` character (or, the 'plain' filter). Tested in the environment in which it previously failed.
1 parent 42c2258 commit 57f84ca

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

templates/facts.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ ansible_managed }}
1+
{{ ansible_managed | comment('plain') }}
22

33
[general]
44
version={{ golang_version }}

templates/golang.sh.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
# {{ ansible_managed }}
3+
{{ ansible_managed | comment('plain') }}
44

55
export GOROOT='{{ golang_install_dir }}'
66
export PATH=$PATH:$GOROOT/bin

0 commit comments

Comments
 (0)