- name: Change machine-id in Debian hosts: all gather_facts: no become: yes tasks: - name: Remove files with old machine-id file: path: "{{ item }}" state: absent loop: - /etc/machine-id - /var/lib/dbus/machine-id - name: Ensure a new UUID is generated for /etc/machine-id command: cmd: dbus-uuidgen --ensure=/etc/machine-id - name: Create symbolic link for /var/lib/dbus/machine-id file: src: /etc/machine-id dest: /var/lib/dbus/machine-id state: link