On Sun, 15 Feb 2015 00:56 -0800, Doug Eubanks <[email protected]>
wrote:
> I'm pretty new to Ansible, but I'm diving in.
> 
> My problem is that I need a playbook entry that will set a config value
> to 
> a certain value if it's different and return "ok" instead of "changed" if 
> it's already set.
> 
> This example always reports "changed":
>     - name: set apache ExtendedStatus
>       lineinfile: dest=/etc/httpd/conf/httpd.conf 
> regexp=^.ExtendedStatus.Off line="ExtendedStatus On"
>       register: apache_server_extended_status

I think your regexp might not be matching the line (because of "^.",
requiring a character before ExtendedStatus). 

Please try this:

- name: set apache ExtendedStatus
  lineinfile:
    dest: /etc/httpd/conf/httpd.conf
    regexp: "^ExtendedStatus.*Off"
    line: "ExtendedStatus On"
  register: apache_server_extended_status

Giovanni

-- 
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/1424098622.1897274.228115285.58093B7C%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to