--- - name: Remove PowerShell's files file: path: "/etc/yum.repos.d/microsoft.repo" state: absent when: - ansible_os_family == 'RedHat' - name: Registering Ubuntu PowerShell repository file: path: "/etc/apt/sources.list.d/microsoft.list" state: absent when: - ansible_distribution == "Ubuntu" - name: Registering Debian AnsiPowerShellble repository apt_repository: repo: deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-{{ ansible_distribution_name }}-prod {{ ansible_distribution_name }} main filename: microsoft.list state: absent update_cache: yes when: - ansible_distribution == "Debian" - name: Remove AnsiPowerShellble's packages package: name: '{{ powershell_packages }}' state: absent update_cache: yes