-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathdeb_remote.yaml
168 lines (158 loc) · 4.88 KB
/
deb_remote.yaml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
---
- hosts: localhost
gather_facts: false
vars_files:
- vars/server.yaml
module_defaults: &pulp_module_defaults
pulp.squeezer.deb_remote: &pulp_connection_details
pulp_url: "{{ pulp_url }}"
username: "{{ pulp_username }}"
password: "{{ pulp_password }}"
validate_certs: "{{ pulp_validate_certs | default(true) }}"
tasks:
- name: Make remote absent
pulp.squeezer.deb_remote:
name: test_deb_remote
state: absent
- name: Clean openapi cache
file:
path: "{{ lookup('env', 'XDG_CACHE_HOME') | default('~/.cache') }}/squeezer"
state: absent
- hosts: tests
gather_facts: false
vars_files:
- vars/server.yaml
module_defaults:
<<: *pulp_module_defaults
tasks:
- name: Create remote
pulp.squeezer.deb_remote:
name: test_deb_remote
url: "https://example.org/deb/"
# Seems like strings are converted to lists of one by ansible:
architectures: ppc64
components:
- jotunheimr
distributions:
- ragnarok
proxy_url: "http://proxy.int:3128"
state: present
register: result
- name: Verify create remote
assert:
that:
- result.changed == true
- result.remote.name == "test_deb_remote"
- result.remote.url == "https://example.org/deb/"
- result.remote.architectures == "ppc64"
- result.remote.components == "jotunheimr"
- result.remote.distributions == "ragnarok"
- result.remote.proxy_url == "http://proxy.int:3128"
- name: Create remote (2nd try)
pulp.squeezer.deb_remote:
name: test_deb_remote
url: "https://example.org/deb/"
architectures:
- ppc64
components: jotunheimr
distributions: ragnarok
proxy_url: "http://proxy.int:3128"
state: present
register: result
- name: Verify create remote (2nd try)
assert:
that:
- result.changed == false
- name: Modify remote
pulp.squeezer.deb_remote:
name: test_deb_remote
policy: on_demand
tls_validation: false
state: present
register: result
- name: Verify modify remote
assert:
that:
- result.changed == true
- result.remote.policy == "on_demand"
- result.remote.tls_validation == false
- name: Modify remote (2nd try)
pulp.squeezer.deb_remote:
name: test_deb_remote
policy: on_demand
tls_validation: false
state: present
register: result
- name: Verify modify remote (2nd try)
assert:
that:
- result.changed == false
- name: Modify sync_installer, sync_sources, and sync_udebs on remote
pulp.squeezer.deb_remote:
name: test_deb_remote
sync_installer: true
sync_sources: true
sync_udebs: true
state: present
register: result
- name: Verify modify sync_installer
assert:
that:
- result.changed == true
- result.remote.sync_installer == true
- name: Modify sync_installer, sync_sources, and sync_udebs on remote (2nd try)
pulp.squeezer.deb_remote:
name: test_deb_remote
sync_installer: true
sync_sources: true
sync_udebs: true
state: present
register: result
- name: Verify modify sync_installer, sync_sources, and sync_udebs on remote (2nd try)
assert:
that:
- result.changed == false
- name: List remotes
pulp.squeezer.deb_remote: {}
register: result
- name: Verify list remotes
assert:
that:
- result.changed == false
- result.remotes | length >= 1
- result.remotes | selectattr('name', 'match', 'test_deb_remote') | list | length == 1
- name: Read remote
pulp.squeezer.deb_remote:
name: test_deb_remote
register: result
- name: Verify read remote
assert:
that:
- result.changed == false
- result.remote.name == "test_deb_remote"
- result.remote.url == "https://example.org/deb/"
- result.remote.architectures == "ppc64"
- result.remote.components == "jotunheimr"
- result.remote.distributions == "ragnarok"
- result.remote.proxy_url == "http://proxy.int:3128"
- result.remote.tls_validation == false
- name: Delete remote
pulp.squeezer.deb_remote:
name: test_deb_remote
state: absent
register: result
- name: Verify delete remote
assert:
that:
- result.changed == true
- not result.remote
- name: Delete remote (2nd try)
pulp.squeezer.deb_remote:
name: test_deb_remote
state: absent
register: result
- name: Verify delete remote (2nd try)
assert:
that:
- result.changed == false
...