Not sure what you mean. You are saying a service call to stop can change a configuration file that is not really related. This is what I think you mean. someservice can sometimes change /etc/sometimesrc
# Capture the MD5 or something similar in one task before stopping the service (Linux, OS X and other may have an `md5` command) - command: md5sum /etc/sometimesrc register: original_md5 changed_when: false # Never report changed for this task - service: name=someservice state=stopped # Can cause file to be changed? # line in stdout should be exactly the same unless the MD5 sum changes - command: md5sum /etc/sometimesrc register: md5sum changed_when: new_md5.stdout != original_md5.stdout # Copy the file conditionally, only if the MD5 sum changed because of stopping the process - copy: src=mysometimesrc dest=/etc/sometimesrc when: md5sum.changed On Tuesday, 8 July 2014 07:32:37 UTC-7, Glen Huang wrote: > > I have a service that overwrites config when it stops. Is it possible to > tell ansible that if a config file changes it should stop the service first > before copying the file? > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/09c3737f-9791-4112-9f3e-719234e10a6e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.