Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/pipx/tasks/testcase-8793-global.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: Set up environment
7 environment:
8 PATH: /root/.local/bin:/usr/local/bin:{{ ansible_facts.env.PATH }}
9 block:
10 - name: Remove global pipx dir
11 ansible.builtin.file:
12 path: /opt/pipx
13 state: absent
14 force: true
15
16 - name: Create global pipx dir
17 ansible.builtin.file:
18 path: /opt/pipx
19 state: directory
20 mode: '0755'
21
22 - name: Uninstall pycowsay
23 community.general.pipx:
24 state: uninstall
25 name: pycowsay
26
27 - name: Uninstall pycowsay (global)
28 community.general.pipx:
29 state: uninstall
30 name: pycowsay
31 global: true
32
33 - name: Run pycowsay (should fail)
34 ansible.builtin.command: pycowsay Moooooooo!
35 changed_when: false
36 ignore_errors: true
37
38 - name: Install pycowsay (global)
39 community.general.pipx:
40 state: install
41 name: pycowsay
42 global: true
43
44 - name: Run pycowsay (should succeed)
45 ansible.builtin.command: pycowsay Moooooooo!
46 changed_when: false
47 register: what_the_cow_said
48
49 - name: Which cow?
50 ansible.builtin.command: which pycowsay
51 changed_when: false
52 register: which_cow
53
54 - name: Assert Moooooooo
55 ansible.builtin.assert:
56 that:
57 - "'Moooooooo!' in what_the_cow_said.stdout"
58 - "'/usr/local/bin/pycowsay' in which_cow.stdout"