Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/hg/tasks/uninstall.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: restore the updated python
7 command: mv "{{ which_python.stdout }}.updated" "{{ which_python.stdout }}"
8
9 - name: restore the updated pip
10 command: mv "{{ which_pip.stdout }}.updated" "{{ which_pip.stdout }}"
11
12 - name: restore the mercurial python interpreter symlink (if needed)
13 lineinfile:
14 path: "{{ which_hg.stdout }}"
15 regexp: "^#!.*$"
16 line: "#!{{ stat_hg_interpreter.stat.path }}"
17 when: stat_hg_interpreter.stat.islnk
18
19 # using the apt module prevents autoremove from working, so call apt-get via shell instead
20 - name: uninstall packages which were not originally installed (apt)
21 shell: apt-get -y remove mercurial && apt-get -y autoremove
22 when: ansible_facts.pkg_mgr == 'apt'
23
24 - name: uninstall packages which were not originally installed (dnf)
25 dnf:
26 name: mercurial
27 state: absent
28 autoremove: true
29 when: ansible_facts.pkg_mgr == 'dnf'
30
31 # the yum module does not have an autoremove parameter
32 - name: uninstall packages which were not originally installed (yum)
33 shell: yum -y autoremove mercurial
34 when: ansible_facts.pkg_mgr == 'yum'
35
36 - name: uninstall packages which were not originally installed
37 package:
38 name: mercurial
39 state: absent
40 when: ansible_facts.pkg_mgr in ['pacman', 'community.general.pacman', 'zypper', 'community.general.zypper', 'apk', 'community.general.apk']
41
42 - name: uninstall packages which were not originally installed (pkgng)
43 package:
44 name: mercurial
45 state: absent
46 autoremove: true
47 when: ansible_facts.pkg_mgr in ['pkgng', 'community.general.pkgng']
48
49 - name: restore the default python
50 raw: mv "{{ which_python.stdout }}.default" "{{ which_python.stdout }}"
51
52 - name: restore the default pip
53 raw: mv "{{ which_pip.stdout }}.default" "{{ which_pip.stdout }}"