2024-10-16 15:53:15 +00:00
|
|
|
- name: Clean deprecated configuration
|
|
|
|
hosts: all
|
|
|
|
gather_facts: no
|
|
|
|
tasks:
|
2025-02-06 07:05:53 +00:00
|
|
|
|
|
|
|
- name: Delete old awx-user and it's configuration
|
|
|
|
block:
|
|
|
|
- name: Delete awx-user
|
|
|
|
tags: awx
|
|
|
|
user:
|
|
|
|
name: awx-user
|
|
|
|
state: absent
|
|
|
|
remove: yes
|
|
|
|
- name: Delete awx-user sudoers file
|
|
|
|
tags: awx
|
|
|
|
file:
|
|
|
|
path: /etc/sudoers.d/awx-user
|
|
|
|
state: absent
|
|
|
|
|
2024-10-16 15:53:15 +00:00
|
|
|
- name: Delete old MOTD configuration
|
2025-02-06 07:05:53 +00:00
|
|
|
tags: motd
|
2024-10-16 15:53:15 +00:00
|
|
|
file:
|
|
|
|
path: /etc/profile.d/mymotd.sh
|
|
|
|
state: absent
|
2025-02-06 07:05:53 +00:00
|
|
|
|
|
|
|
- name: Delete old profile configuration
|
|
|
|
tags: profile
|
|
|
|
block:
|
|
|
|
- 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
|
|
|
|
- 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'
|
|
|
|
|
2025-02-06 06:56:39 +00:00
|
|
|
- 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', '<')
|