Quick Ansible to update a file

Self reference.
Use case was to update a configfile (datadog) in all currently running instances..And restart the process.

- hosts: all
  tasks:
    - name: line insert
      lineinfile:
        path: /etc/datadog-agent/datadog.yaml
        insertafter: 'collect_ec2_tags: false'
        line: 'collect_ec2_tags: true'
      notify:
        - restarting
      become: true
  handlers:
    - name: restarting
      service:
        name: datadog-agent
        state: restarted
      become: true

hosts file:

[all]
192.x.x.x
192.x.x.x