I understand the functionality of lineinfile a bit better now and solved 
this with...  

    - name:  uncomment a line
      lineinfile: backup=yes state=present dest=/etc/ssh/sshd_config 
regexp='^#?Banner' line='Banner /etc/issue.net'

Also, it appears I can utilize the original regexp with a backrefs=yes to 
achieve the desired result as well.

Either way I am moving towards using a template.

On Tuesday, April 12, 2016 at 5:54:01 PM UTC-5, [email protected] wrote:
>
> I have the following in a playbook to uncomment a line.  The first time I 
> run it everything works fine.  If I run it again it inserts a "Banner /etc/
> issue.net" at the EOF.  Is there a better way to do this?
>
>  - name:  uncomment a line
>       lineinfile: backup=yes state=present dest=/etc/ssh/sshd_config 
> regexp='^#Banner' line='Banner /etc/issue.net'
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/01ad4e43-4c23-4cc3-8e48-e185c547bd80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to