- name: Clean deprecated configuration hosts: all gather_facts: no tasks: - name: Delete awx-user user: name: awx-user state: absent remove: yes tags: awx - name: Delete awx-user sudoers file file: path: /etc/sudoers.d/awx-user state: absent tags: awx - name: Delete old MOTD configuration file: path: /etc/profile.d/mymotd.sh state: absent tags: motd - name: Delete old Ansible bashrc configuration blockinfile: path: /root/.bashrc marker_begin: 'BEGIN ANSIBLE MANAGED BLOCK' marker_end: 'END ANSIBLE MANAGED BLOCK' marker: "# {mark}" state: absent tags: bashrc - name: Delete old custom bashrc configuration replace: path: /root/.bashrc regexp: '{{ start_delimiter }}\\s\\S*?{{ end_delimiter }}' replace: '' vars: start_delimiter: '### 4Loo' end_delimiter: 'esac' - name: Delete old vn-host package tags: vn-host block: - name: Get vn-host package version shell: "dpkg-query -W -f='${Version}' vn-host 2>/dev/null || echo '0'" register: vn_host_version changed_when: false - name: Display vn-host version debug: msg: "Version: {{ vn_host_version.stdout }}" - name: Uninstall vn-host if old version apt: name: vn-host state: absent when: > vn_host_version.stdout is version('3.0.0', '<')