summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/apt/tasks/url-with-deps.yml
blob: 7c70eb903b04f0fbc6b3d8d2af28dc8488a10b6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- block:
    - name: Install https transport for apt
      apt:
        name: apt-transport-https

    - name: Ensure echo-hello is not installed
      apt:
        name: echo-hello
        state: absent
        purge: yes

    # Note that this .deb is just a stupidly tiny one that has a dependency
    # on vim-tiny. Really any .deb will work here so long as it has
    # dependencies that exist in a repo and get brought in.
    # The source and files for building this .deb can be found here:
    # https://ci-files.testing.ansible.com/test/integration/targets/apt/echo-hello-source.tar.gz
    - name: Install deb file with dependencies from URL (check_mode)
      apt:
        deb: https://ci-files.testing.ansible.com/test/integration/targets/apt/echo-hello_1.0_all.deb
      check_mode: true
      register: apt_url_deps_check_mode

    - name: check to make sure we didn't install the package due to check_mode
      shell: dpkg-query -l echo-hello
      failed_when: false
      register: dpkg_result_check_mode

    - name: verify check_mode installation of echo-hello
      assert:
        that:
        - apt_url_deps_check_mode is changed
        - dpkg_result_check_mode.rc != 0

    - name: Install deb file with dependencies from URL (for real this time)
      apt:
        deb: https://ci-files.testing.ansible.com/test/integration/targets/apt/echo-hello_1.0_all.deb
      register: apt_url_deps

    - name: check to make sure we installed the package
      shell: dpkg-query -l echo-hello
      failed_when: False
      register: dpkg_result

    - name: verify real installation of echo-hello
      assert:
        that:
        - apt_url_deps is changed
        - dpkg_result is successful
        - dpkg_result.rc == 0

  always:
    - name: uninstall echo-hello with apt
      apt:
        pkg: echo-hello
        state: absent
        purge: yes