- name: Say hello hosts: myhosts tasks: - name: Print message ansible.builtin.debug: msg: Hello world - name: Ignore lidswitch hosts: myhosts tasks: - name: Ignore lid switch ansible.builtin.lineinfile: path: /etc/systemd/logind.conf regexp: '^#?HandleLidSwitch=' line: 'HandleLidSwitch=ignore' state: present become: true notify: Restart logind handlers: - name: Restart logind ansible.builtin.systemd: name: systemd-logind state: restarted become: true