Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/ansible
Path: blob/devel/test/integration/targets/apt/tasks/url-with-deps.yml
4751 views
1
- block:
2
- name: Install https transport for apt
3
apt:
4
name: apt-transport-https
5
6
- name: Ensure echo-hello is not installed
7
apt:
8
name: echo-hello
9
state: absent
10
purge: yes
11
12
# Note that this .deb is just a stupidly tiny one that has a dependency
13
# on vim-tiny. Really any .deb will work here so long as it has
14
# dependencies that exist in a repo and get brought in.
15
# The source and files for building this .deb can be found here:
16
# https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/apt/echo-hello-source.tar.gz
17
- name: Install deb file with dependencies from URL (check_mode)
18
apt:
19
deb: https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/apt/echo-hello_1.0_all.deb
20
check_mode: true
21
register: apt_url_deps_check_mode
22
23
- name: check to make sure we didn't install the package due to check_mode
24
shell: dpkg-query -l echo-hello
25
failed_when: false
26
register: dpkg_result_check_mode
27
28
- name: verify check_mode installation of echo-hello
29
assert:
30
that:
31
- apt_url_deps_check_mode is changed
32
- dpkg_result_check_mode.rc != 0
33
34
- name: Install deb file with dependencies from URL (for real this time)
35
apt:
36
deb: https://ansible-ci-files.s3.amazonaws.com/test/integration/targets/apt/echo-hello_1.0_all.deb
37
register: apt_url_deps
38
39
- name: check to make sure we installed the package
40
shell: dpkg-query -l echo-hello
41
failed_when: False
42
register: dpkg_result
43
44
- name: verify real installation of echo-hello
45
assert:
46
that:
47
- apt_url_deps is changed
48
- dpkg_result is successful
49
- dpkg_result.rc == 0
50
51
always:
52
- name: uninstall echo-hello with apt
53
apt:
54
pkg: echo-hello
55
state: absent
56
purge: yes
57
58