Thanks very much Mr Olstad :) On Saturday, 23 July 2016 10:03:35 UTC-4, Kai Stian Olstad wrote: > > On 22. juli 2016 19:23, GANA SAGAR wrote: > > Is lineinfile really idempotent ?? > > Yes and no, it depend on how you use it. > > > I am using it to uncomment the > > logrorate option in logrotate.conf. Everytime I run the playbook. This > play > > is being executed every single time and add the word compress at the > bottom > > after every run. Am I doing something wrong ?? > > It is actually working as the documentation is describing. > If it can't find the regexp expression the line will be added to the > file, default is EOF since insertafter take presidence and is default > set to EOF. > > Someone has created a issue about this behavior. > https://github.com/ansible/ansible-modules-core/issues/3975 > > > > - name: Enabling the logrotate option for linux servers > > lineinfile: dest=/etc/logrotate.conf > > backup=yes > > regexp="^#compress" > > line="compress" > > create=yes > > when: ansible_distribution == "RedHat" > > If you add backrefs=yes it will work as you expect, it disables > insertafter. > > -- > Kai Stian Olstad >
-- 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/40b19f8c-4eba-467c-8968-9fed22a92e17%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
