--- - name: Remove static ip configuration. file: path: /etc/NetworkManager/system-connections/static.nmconnection state: absent - name: Read temporary public key. set_fact: tmp_pub_key: "{{ lookup('file', '.ssh/id_ed25519.pub') }}" - name: Remove temporary key from root's authorized_keys. authorized_key: state: absent user: root path: /root/.ssh/authorized_keys key: "{{ tmp_pub_key }}" manage_dir: true - name: Disable ssh server. systemd: name: sshd enabled: false state: stopped