This works under a regexp tester, but fails under ansible. I don't know how to correct it.
Basically, it finds the lines starting with passwd or group, looks in the lines for sss, and appends if it isn't found. - name: Update nsswitch.conf replace: path: /etc/nsswitch.conf regexp: "{{item.regexp}}" replace: "{{item.replace}}" with_items: - {regexp: '^(?:passwd):\s+(?:(?!sss).)+$', replace: '\0 sss'} - {regexp: '^(?:group):\s+(?:(?!sss).)+$', replace: '\0 sss'} notify: restart sssd Actual results (it wipes out the match and adds " sss") # Example: #passwd: db files nisplus nis #shadow: db files nisplus nis #group: db files nisplus nis sss shadow: files sss #hosts: db files nisplus nis dns hosts: files dns -- 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/e8781073-3278-4872-92c2-ca1fe847362d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.