--- - name: Add telegraf to docker group ansible.builtin.user: name: telegraf groups: docker append: true when: "docker is defined and docker == 'true'" notify: - Restart telegraf - name: Deploy configuration file ansible.builtin.template: src: telegraf.conf.j2 dest: /etc/telegraf/telegraf.conf mode: "644" notify: - Restart telegraf