Why wouldn't it change it every time, your regex is looking for lines 
starting with 'check system', and even after the change the line still 
starts with that.  I'm just getting started with ansible myself, so I don't 
have a quick solution for you, but given the snippet you provided, that 
would be expected behavior.

---Jim

On Saturday, February 20, 2016 at 11:35:15 AM UTC-5, Austin Butler wrote:
>
> The lineinfile module is consistently reporting changed on a step. The 
> actual replace works fine the first time, and it's not harming anything on 
> subsequent runs so I guess it's mostly a cosmetic issue, but still I am 
> trying to keep changes to, you know, actual changes.
>
> I am wondering if this is from the variable used in the line file 
> ("inventory_hostname"). Any ideas? Or is this bug report worthy?
>
> Version of Ansible: 2.0.0.2
>
> Playbook snippet:
> - name: configure hostname for checks
>   lineinfile:
>     dest: '/etc/monit.d/system.conf'
>     regexp: '^check system'
>     line: 'check system {{ inventory_hostname }}'
>
> Original file:
> check system test
>     if MEMORY > 80% for 6 cycles then alert
>     if LOADAVG(15min) > 20 for 12 cycles then alert
>     if SWAP > 20% for 6 cycles then alert
>
> File after first run (and all subsequent runs):
> check system 192.168.50.3
>     if MEMORY > 80% for 6 cycles then alert
>     if LOADAVG(15min) > 20 for 12 cycles then alert
>     if SWAP > 20% for 6 cycles then alert
>

-- 
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/c116c78c-a699-4271-bacd-c3cea82d233c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to