| 1 |
- name: Test podman_container |
| 2 |
block: |
| 3 |
|
| 4 |
- name: Discover podman version |
| 5 |
shell: podman version | grep "^Version:" | awk {'print $2'} |
| 6 |
register: podman_v |
| 7 |
|
| 8 |
- name: Set podman version to 3 |
| 9 |
set_fact: |
| 10 |
podman_version: 3 |
| 11 |
when: podman_v.stdout is version('4.0.0', 'lt') |
| 12 |
|
| 13 |
- name: Set podman version to 4 |
| 14 |
set_fact: |
| 15 |
podman_version: 4 |
| 16 |
when: podman_v.stdout is version('4.0.0', '>=') |
| 17 |
|
| 18 |
- name: Set podman version to 5 |
| 19 |
set_fact: |
| 20 |
podman_version: 5 |
| 21 |
when: podman_v.stdout is version('5.0.0', '>=') |
| 22 |
|
| 23 |
- name: Set podman version to 6 |
| 24 |
set_fact: |
| 25 |
podman_version: 6 |
| 26 |
when: podman_v.stdout is version('6.0.0', '>=') |
| 27 |
|
| 28 |
- name: Delete all container leftovers from tests |
| 29 |
containers.podman.podman_container: |
| 30 |
executable: "{{ test_executable | default('podman') }}" |
| 31 |
name: "{{ item }}" |
| 32 |
state: absent |
| 33 |
loop: |
| 34 |
- "alpine:3.7" |
| 35 |
- "container" |
| 36 |
- "container1" |
| 37 |
- "container2" |
| 38 |
- "container3" |
| 39 |
- "testidem-pod" |
| 40 |
|
| 41 |
- name: Test no image with default action |
| 42 |
containers.podman.podman_container: |
| 43 |
executable: "{{ test_executable | default('podman') }}" |
| 44 |
name: container |
| 45 |
ignore_errors: true |
| 46 |
register: no_image |
| 47 |
|
| 48 |
- name: Test no image with state 'started' |
| 49 |
containers.podman.podman_container: |
| 50 |
executable: "{{ test_executable | default('podman') }}" |
| 51 |
name: container |
| 52 |
state: created |
| 53 |
ignore_errors: true |
| 54 |
register: no_image1 |
| 55 |
|
| 56 |
- name: Test no image with state 'present' |
| 57 |
containers.podman.podman_container: |
| 58 |
executable: "{{ test_executable | default('podman') }}" |
| 59 |
name: container |
| 60 |
state: present |
| 61 |
ignore_errors: true |
| 62 |
register: no_image2 |
| 63 |
|
| 64 |
- name: Check no image |
| 65 |
assert: |
| 66 |
that: |
| 67 |
- no_image is failed |
| 68 |
- no_image1 is failed |
| 69 |
- no_image2 is failed |
| 70 |
- no_image.msg == "Cannot start container when image is not specified!" |
| 71 |
- no_image1.msg == "State 'created' required image to be configured!" |
| 72 |
- no_image2.msg == "State 'present' required image to be configured!" |
| 73 |
fail_msg: No image test failed! |
| 74 |
success_msg: No image test passed! |
| 75 |
|
| 76 |
- name: Ensure image doesn't exist |
| 77 |
containers.podman.podman_image: |
| 78 |
executable: "{{ test_executable | default('podman') }}" |
| 79 |
name: alpine:3.7 |
| 80 |
state: absent |
| 81 |
|
| 82 |
- name: Check pulling image |
| 83 |
containers.podman.podman_container: |
| 84 |
executable: "{{ test_executable | default('podman') }}" |
| 85 |
name: container |
| 86 |
image: alpine:3.7 |
| 87 |
state: started |
| 88 |
command: sleep 1d |
| 89 |
register: image |
| 90 |
|
| 91 |
- name: Check using already pulled image |
| 92 |
containers.podman.podman_container: |
| 93 |
executable: "{{ test_executable | default('podman') }}" |
| 94 |
name: container2 |
| 95 |
image: alpine:3.7 |
| 96 |
state: started |
| 97 |
command: sleep 1d |
| 98 |
register: image2 |
| 99 |
|
| 100 |
- name: Check output is correct |
| 101 |
assert: |
| 102 |
that: |
| 103 |
- image is changed |
| 104 |
- image.container is defined |
| 105 |
- image.container['State']['Running'] |
| 106 |
- "'pulled image alpine:3.7' in image.actions" |
| 107 |
- "'started container' in image.actions" |
| 108 |
- image2 is changed |
| 109 |
- image2.container is defined |
| 110 |
- image2.container['State']['Running'] |
| 111 |
- "'pulled image alpine:3.7' not in image2.actions" |
| 112 |
- "'started container2' in image2.actions" |
| 113 |
fail_msg: Pulling image test failed! |
| 114 |
success_msg: Pulling image test passed! |
| 115 |
|
| 116 |
- name: Ensure image doesn't exist - TLS verify OFF |
| 117 |
containers.podman.podman_image: |
| 118 |
executable: "{{ test_executable | default('podman') }}" |
| 119 |
name: alpine:3.20 |
| 120 |
state: absent |
| 121 |
|
| 122 |
- name: Check pulling image - TLS verify OFF |
| 123 |
containers.podman.podman_container: |
| 124 |
executable: "{{ test_executable | default('podman') }}" |
| 125 |
name: container_tls |
| 126 |
image: alpine:3.20 |
| 127 |
state: started |
| 128 |
command: sleep 1d |
| 129 |
tls_verify: false |
| 130 |
register: image_tls |
| 131 |
|
| 132 |
- name: Check output is correct - TLS verify OFF |
| 133 |
assert: |
| 134 |
that: |
| 135 |
- image_tls.podman_actions | select('search', '--tls-verify=False') | list | length > 0 |
| 136 |
|
| 137 |
- name: Check using already pulled image - TLS verify OFF |
| 138 |
containers.podman.podman_container: |
| 139 |
executable: "{{ test_executable | default('podman') }}" |
| 140 |
name: container2_tls |
| 141 |
image: alpine:3.20 |
| 142 |
state: started |
| 143 |
command: sleep 1d |
| 144 |
tls_verify: false |
| 145 |
register: image2_tls |
| 146 |
|
| 147 |
- name: Check output is correct - TLS verify OFF |
| 148 |
assert: |
| 149 |
that: |
| 150 |
- image_tls is changed |
| 151 |
- image_tls.container is defined |
| 152 |
- image_tls.container['State']['Running'] |
| 153 |
- "'pulled image alpine:3.20' in image_tls.actions" |
| 154 |
- "'started container_tls' in image_tls.actions" |
| 155 |
- image2_tls is changed |
| 156 |
- image2_tls.container is defined |
| 157 |
- image2_tls.container['State']['Running'] |
| 158 |
- "'pulled image alpine:3.20' not in image2_tls.actions" |
| 159 |
- "'started container2_tls' in image2_tls.actions" |
| 160 |
fail_msg: Pulling image test failed! |
| 161 |
success_msg: Pulling image test passed! |
| 162 |
|
| 163 |
- name: Check failed image pull |
| 164 |
containers.podman.podman_container: |
| 165 |
executable: "{{ test_executable | default('podman') }}" |
| 166 |
name: container |
| 167 |
image: ineverneverneverexist |
| 168 |
state: started |
| 169 |
command: sleep 1d |
| 170 |
register: imagefail |
| 171 |
ignore_errors: true |
| 172 |
|
| 173 |
- name: Check output is correct |
| 174 |
assert: |
| 175 |
that: |
| 176 |
- imagefail is failed |
| 177 |
- imagefail.msg == "Can't pull image ineverneverneverexist" |
| 178 |
|
| 179 |
- name: Force container recreate |
| 180 |
containers.podman.podman_container: |
| 181 |
executable: "{{ test_executable | default('podman') }}" |
| 182 |
name: container |
| 183 |
image: alpine |
| 184 |
state: started |
| 185 |
command: sleep 1d |
| 186 |
recreate: true |
| 187 |
register: recreated |
| 188 |
|
| 189 |
- name: Check output is correct |
| 190 |
assert: |
| 191 |
that: |
| 192 |
- recreated is changed |
| 193 |
- recreated.container is defined |
| 194 |
- recreated.container['State']['Running']|bool |
| 195 |
- "'recreated container' in recreated.actions" |
| 196 |
fail_msg: Force recreate test failed! |
| 197 |
success_msg: Force recreate test passed! |
| 198 |
|
| 199 |
- name: Start container |
| 200 |
containers.podman.podman_container: |
| 201 |
executable: "{{ test_executable | default('podman') }}" |
| 202 |
name: container |
| 203 |
state: started |
| 204 |
|
| 205 |
- name: Present container |
| 206 |
containers.podman.podman_container: |
| 207 |
executable: "{{ test_executable | default('podman') }}" |
| 208 |
name: container |
| 209 |
image: alpine |
| 210 |
state: present |
| 211 |
command: sleep 1d |
| 212 |
register: start_present |
| 213 |
|
| 214 |
- name: Check output is correct |
| 215 |
assert: |
| 216 |
that: |
| 217 |
- start_present.container['State']['Running'] |
| 218 |
|
| 219 |
- name: Stop container |
| 220 |
containers.podman.podman_container: |
| 221 |
executable: "{{ test_executable | default('podman') }}" |
| 222 |
name: container |
| 223 |
state: stopped |
| 224 |
register: stopped |
| 225 |
|
| 226 |
- name: Stop the same container again (idempotency) |
| 227 |
containers.podman.podman_container: |
| 228 |
executable: "{{ test_executable | default('podman') }}" |
| 229 |
name: container |
| 230 |
state: stopped |
| 231 |
register: stopped_again |
| 232 |
|
| 233 |
- name: Check output is correct |
| 234 |
assert: |
| 235 |
that: |
| 236 |
- stopped is changed |
| 237 |
- stopped.container is defined |
| 238 |
- not stopped.container['State']['Running'] |
| 239 |
- "'stopped container' in stopped.actions" |
| 240 |
- stopped_again is not changed |
| 241 |
- stopped_again.container is defined |
| 242 |
- not stopped_again.container['State']['Running'] |
| 243 |
- stopped_again.actions == [] |
| 244 |
fail_msg: Stopping container test failed! |
| 245 |
success_msg: Stopping container test passed! |
| 246 |
|
| 247 |
- name: Delete stopped container |
| 248 |
containers.podman.podman_container: |
| 249 |
executable: "{{ test_executable | default('podman') }}" |
| 250 |
name: container |
| 251 |
state: absent |
| 252 |
register: deleted |
| 253 |
|
| 254 |
- name: Delete again container (idempotency) |
| 255 |
containers.podman.podman_container: |
| 256 |
executable: "{{ test_executable | default('podman') }}" |
| 257 |
name: container |
| 258 |
state: absent |
| 259 |
register: deleted_again |
| 260 |
|
| 261 |
- name: Check output is correct |
| 262 |
assert: |
| 263 |
that: |
| 264 |
- deleted is changed |
| 265 |
- deleted.container is defined |
| 266 |
- deleted.container == {} |
| 267 |
- "'deleted container' in deleted.actions" |
| 268 |
- deleted_again is not changed |
| 269 |
- deleted_again.container is defined |
| 270 |
- deleted_again.container == {} |
| 271 |
- deleted_again.actions == [] |
| 272 |
fail_msg: Deleting stopped container test failed! |
| 273 |
success_msg: Deleting stopped container test passed! |
| 274 |
|
| 275 |
- name: Create container in 'stopped' state |
| 276 |
containers.podman.podman_container: |
| 277 |
executable: "{{ test_executable | default('podman') }}" |
| 278 |
name: container |
| 279 |
image: alpine:3.7 |
| 280 |
state: stopped |
| 281 |
command: sleep 1d |
| 282 |
register: created |
| 283 |
|
| 284 |
- name: Check output is correct |
| 285 |
assert: |
| 286 |
that: |
| 287 |
- created is changed |
| 288 |
- created.container is defined |
| 289 |
- created.container != {} |
| 290 |
- not created.container['State']['Running'] |
| 291 |
- "'created container' in created.actions" |
| 292 |
fail_msg: "Creating stopped container test failed!" |
| 293 |
success_msg: "Creating stopped container test passed!" |
| 294 |
|
| 295 |
- name: Force recreate stopped container |
| 296 |
containers.podman.podman_container: |
| 297 |
executable: "{{ test_executable | default('podman') }}" |
| 298 |
name: container |
| 299 |
image: alpine:3.7 |
| 300 |
state: started |
| 301 |
command: sleep 1d |
| 302 |
recreate: true |
| 303 |
register: recreate_stopped |
| 304 |
|
| 305 |
- name: Check output is correct |
| 306 |
assert: |
| 307 |
that: |
| 308 |
- recreate_stopped is changed |
| 309 |
- recreate_stopped.container is defined |
| 310 |
- recreate_stopped.container['State']['Running']|bool |
| 311 |
- "'recreated container' in recreate_stopped.actions" |
| 312 |
fail_msg: Force recreate stopped test failed! |
| 313 |
success_msg: Force recreate stopped test passed! |
| 314 |
|
| 315 |
- name: Delete created container |
| 316 |
containers.podman.podman_container: |
| 317 |
executable: "{{ test_executable | default('podman') }}" |
| 318 |
name: container |
| 319 |
state: absent |
| 320 |
|
| 321 |
- name: Create container in 'created' state |
| 322 |
containers.podman.podman_container: |
| 323 |
executable: "{{ test_executable | default('podman') }}" |
| 324 |
name: container |
| 325 |
image: alpine:3.7 |
| 326 |
state: created |
| 327 |
command: sleep 1d |
| 328 |
register: created |
| 329 |
|
| 330 |
- name: Check output is correct |
| 331 |
assert: |
| 332 |
that: |
| 333 |
- created is changed |
| 334 |
- created.container is defined |
| 335 |
- created.container != {} |
| 336 |
- not created.container['State']['Running'] |
| 337 |
- "'created container' in created.actions" |
| 338 |
fail_msg: "Creating stopped container test failed!" |
| 339 |
success_msg: "Creating stopped container test passed!" |
| 340 |
|
| 341 |
- name: Force container recreate |
| 342 |
containers.podman.podman_container: |
| 343 |
executable: "{{ test_executable | default('podman') }}" |
| 344 |
name: container |
| 345 |
image: alpine |
| 346 |
state: created |
| 347 |
command: sleep 1d |
| 348 |
recreate: true |
| 349 |
register: recreated |
| 350 |
|
| 351 |
- name: Check output is correct |
| 352 |
assert: |
| 353 |
that: |
| 354 |
- recreated is changed |
| 355 |
- recreated.container is defined |
| 356 |
- not recreated.container['State']['Running'] |
| 357 |
- "'recreated container' in recreated.actions" |
| 358 |
fail_msg: Force recreate test failed! |
| 359 |
|
| 360 |
- name: Restart container |
| 361 |
containers.podman.podman_container: |
| 362 |
executable: "{{ test_executable | default('podman') }}" |
| 363 |
name: container |
| 364 |
restart: true |
| 365 |
register: restarted |
| 366 |
|
| 367 |
- name: Check output is correct |
| 368 |
assert: |
| 369 |
that: |
| 370 |
- restarted is changed |
| 371 |
- restarted.container is defined |
| 372 |
- restarted.container['State']['Running'] |
| 373 |
- "'restarted container' in restarted.actions" |
| 374 |
fail_msg: Restart container test failed! |
| 375 |
|
| 376 |
- name: Restart running container |
| 377 |
containers.podman.podman_container: |
| 378 |
executable: "{{ test_executable | default('podman') }}" |
| 379 |
name: container |
| 380 |
restart: true |
| 381 |
register: restarted |
| 382 |
|
| 383 |
- name: Check output is correct |
| 384 |
assert: |
| 385 |
that: |
| 386 |
- restarted is changed |
| 387 |
- restarted.container is defined |
| 388 |
- restarted.container['State']['Running'] |
| 389 |
- "'restarted container' in restarted.actions" |
| 390 |
fail_msg: Restart running container test failed! |
| 391 |
|
| 392 |
- name: Delete created container |
| 393 |
containers.podman.podman_container: |
| 394 |
executable: "{{ test_executable | default('podman') }}" |
| 395 |
name: container |
| 396 |
state: absent |
| 397 |
|
| 398 |
- name: Start container that was deleted |
| 399 |
containers.podman.podman_container: |
| 400 |
executable: "{{ test_executable | default('podman') }}" |
| 401 |
name: container |
| 402 |
image: alpine:3.7 |
| 403 |
state: started |
| 404 |
command: sleep 1d |
| 405 |
register: started |
| 406 |
|
| 407 |
- name: Check output is correct |
| 408 |
assert: |
| 409 |
that: |
| 410 |
- started is changed |
| 411 |
- started.container is defined |
| 412 |
- started.container['State']['Running'] |
| 413 |
- "'pulled image alpine:3.7' not in started.actions" |
| 414 |
|
| 415 |
- name: Delete started container |
| 416 |
containers.podman.podman_container: |
| 417 |
executable: "{{ test_executable | default('podman') }}" |
| 418 |
name: container |
| 419 |
state: absent |
| 420 |
register: deleted |
| 421 |
|
| 422 |
- name: Delete again container (idempotency) |
| 423 |
containers.podman.podman_container: |
| 424 |
executable: "{{ test_executable | default('podman') }}" |
| 425 |
name: container |
| 426 |
state: absent |
| 427 |
register: deleted_again |
| 428 |
|
| 429 |
- name: Check output is correct |
| 430 |
assert: |
| 431 |
that: |
| 432 |
- deleted is changed |
| 433 |
- deleted.container is defined |
| 434 |
- deleted.container == {} |
| 435 |
- "'deleted container' in deleted.actions" |
| 436 |
- deleted_again is not changed |
| 437 |
- deleted_again.container is defined |
| 438 |
- deleted_again.container == {} |
| 439 |
- deleted_again.actions == [] |
| 440 |
fail_msg: Deleting started container test failed! |
| 441 |
success_msg: Deleting started container test passed! |
| 442 |
|
| 443 |
- name: Create container with security_opt |
| 444 |
containers.podman.podman_container: |
| 445 |
executable: "{{ test_executable | default('podman') }}" |
| 446 |
name: container |
| 447 |
image: docker.io/alpine:3.7 |
| 448 |
state: started |
| 449 |
command: sleep 1d |
| 450 |
security_opt: |
| 451 |
- label=level:s0 |
| 452 |
- label=type:spc_t |
| 453 |
- label=filetype:container_share_t |
| 454 |
- seccomp=unconfined |
| 455 |
|
| 456 |
- name: Recreate container with same security_opt flags |
| 457 |
containers.podman.podman_container: |
| 458 |
executable: "{{ test_executable | default('podman') }}" |
| 459 |
name: container |
| 460 |
image: docker.io/alpine:3.7 |
| 461 |
state: started |
| 462 |
command: sleep 1d |
| 463 |
security_opt: |
| 464 |
- label=level:s0 |
| 465 |
- label=type:spc_t |
| 466 |
- label=filetype:container_share_t |
| 467 |
- seccomp=unconfined |
| 468 |
register: recreate_security_opt |
| 469 |
|
| 470 |
- name: Check if output is correct |
| 471 |
assert: |
| 472 |
that: |
| 473 |
- recreate_security_opt is not changed |
| 474 |
- recreate_security_opt.container is defined |
| 475 |
- recreate_security_opt.container != {} |
| 476 |
- recreate_security_opt.container['State']['Running'] |
| 477 |
- "'recreated container' not in recreate_security_opt.actions" |
| 478 |
|
| 479 |
- name: Remove container |
| 480 |
containers.podman.podman_container: |
| 481 |
executable: "{{ test_executable | default('podman') }}" |
| 482 |
name: container |
| 483 |
state: absent |
| 484 |
|
| 485 |
- name: Recreate container with parameters |
| 486 |
containers.podman.podman_container: |
| 487 |
executable: "{{ test_executable | default('podman') }}" |
| 488 |
name: container |
| 489 |
image: docker.io/alpine:3.7 |
| 490 |
state: started |
| 491 |
command: sleep 1d |
| 492 |
recreate: true |
| 493 |
etc_hosts: |
| 494 |
host1: 127.0.0.1 |
| 495 |
host2: 127.0.0.1 |
| 496 |
annotation: |
| 497 |
this: "annotation_value" |
| 498 |
dns: |
| 499 |
- 1.1.1.1 |
| 500 |
- 8.8.4.4 |
| 501 |
dns_search: example.com |
| 502 |
cap_add: |
| 503 |
- SYS_TIME |
| 504 |
- NET_ADMIN |
| 505 |
publish: |
| 506 |
- "9000:80" |
| 507 |
- "9001:8000" |
| 508 |
workdir: "/bin" |
| 509 |
env: |
| 510 |
FOO: bar=1 |
| 511 |
BAR: foo |
| 512 |
TEST: 1 |
| 513 |
BOOL: false |
| 514 |
label: |
| 515 |
somelabel: labelvalue |
| 516 |
otheralbe: othervalue |
| 517 |
volumes: |
| 518 |
- /tmp:/data |
| 519 |
mounts: |
| 520 |
- type=devpts,destination=/dev/pts |
| 521 |
register: test |
| 522 |
|
| 523 |
- name: Check output is correct |
| 524 |
assert: |
| 525 |
that: |
| 526 |
- test is changed |
| 527 |
- test.container is defined |
| 528 |
- test.container != {} |
| 529 |
- test.container['State']['Running'] |
| 530 |
# test capabilities |
| 531 |
- "'CAP_SYS_TIME' in test.container['BoundingCaps']" |
| 532 |
- "'CAP_NET_ADMIN' in test.container['BoundingCaps']" |
| 533 |
# test annotations |
| 534 |
- test.container['Config']['Annotations']['this'] is defined |
| 535 |
- test.container['Config']['Annotations']['this'] == "annotation_value" |
| 536 |
# test DNS |
| 537 |
- >- |
| 538 |
(test.container['HostConfig']['Dns'] is defined and |
| 539 |
test.container['HostConfig']['Dns'] == ['1.1.1.1', '8.8.4.4']) or |
| 540 |
(test.container['HostConfig']['DNS'] is defined and |
| 541 |
test.container['HostConfig']['DNS'] == ['1.1.1.1', '8.8.4.4']) |
| 542 |
# test ports |
| 543 |
- test.container['NetworkSettings']['Ports']|length == 2 |
| 544 |
# test working dir |
| 545 |
- test.container['Config']['WorkingDir'] == "/bin" |
| 546 |
# test dns search |
| 547 |
- >- |
| 548 |
(test.container['HostConfig']['DnsSearch'] is defined and |
| 549 |
test.container['HostConfig']['DnsSearch'] == ['example.com']) or |
| 550 |
(test.container['HostConfig']['DNSSearch'] is defined and |
| 551 |
test.container['HostConfig']['DNSSearch'] == ['example.com']) |
| 552 |
# test environment variables |
| 553 |
- "'FOO=bar=1' in test.container['Config']['Env']" |
| 554 |
- "'BAR=foo' in test.container['Config']['Env']" |
| 555 |
- "'TEST=1' in test.container['Config']['Env']" |
| 556 |
- "'BOOL=False' in test.container['Config']['Env']" |
| 557 |
# test labels |
| 558 |
- test.container['Config']['Labels'] | length == 2 |
| 559 |
- test.container['Config']['Labels']['somelabel'] == "labelvalue" |
| 560 |
- test.container['Config']['Labels']['otheralbe'] == "othervalue" |
| 561 |
# test mounts |
| 562 |
- test.container['Mounts'][0]['Type'] is defined and test.container['Mounts'][0]['Type'] == 'bind' |
| 563 |
- >- |
| 564 |
test.container['Mounts'][0]['Source'] is defined and test.container['Mounts'][0]['Source'] == 'devpts' or |
| 565 |
test.container['Mounts'][1]['Source'] is defined and test.container['Mounts'][1]['Source'] == 'devpts' |
| 566 |
- >- |
| 567 |
test.container['Mounts'][0]['Destination'] is defined and test.container['Mounts'][0]['Destination'] == '/dev/pts' or |
| 568 |
test.container['Mounts'][1]['Destination'] is defined and test.container['Mounts'][1]['Destination'] == '/dev/pts' |
| 569 |
# test volumes |
| 570 |
# test volumes |
| 571 |
- >- |
| 572 |
(test.container['Mounts'][0]['Destination'] is defined and |
| 573 |
'/data' in test.container['Mounts'] | map(attribute='Destination') | list) |
| 574 |
- >- |
| 575 |
(test.container['Mounts'][1]['Source'] is defined and |
| 576 |
'/tmp' in test.container['Mounts'] | map(attribute='Source') | list) |
| 577 |
fail_msg: Parameters container test failed! |
| 578 |
success_msg: Parameters container test passed! |
| 579 |
|
| 580 |
- name: Check basic idempotency of running container |
| 581 |
containers.podman.podman_container: |
| 582 |
executable: "{{ test_executable | default('podman') }}" |
| 583 |
name: testidem |
| 584 |
image: docker.io/alpine |
| 585 |
state: started |
| 586 |
command: sleep 20m |
| 587 |
|
| 588 |
- name: Check basic idempotency of running container - run it again |
| 589 |
containers.podman.podman_container: |
| 590 |
executable: "{{ test_executable | default('podman') }}" |
| 591 |
name: testidem |
| 592 |
image: alpine:latest |
| 593 |
state: started |
| 594 |
command: sleep 20m |
| 595 |
register: idem |
| 596 |
|
| 597 |
- name: Check that nothing was changed |
| 598 |
assert: |
| 599 |
that: |
| 600 |
- not idem.changed |
| 601 |
|
| 602 |
- name: Check force restart option - run again and force restart |
| 603 |
containers.podman.podman_container: |
| 604 |
executable: "{{ test_executable | default('podman') }}" |
| 605 |
name: testidem |
| 606 |
image: alpine:latest |
| 607 |
state: started |
| 608 |
command: sleep 20m |
| 609 |
force_restart: true |
| 610 |
register: idem_r |
| 611 |
|
| 612 |
- name: Check that task was changed |
| 613 |
assert: |
| 614 |
that: |
| 615 |
- idem_r is changed |
| 616 |
|
| 617 |
- name: Check removing force_restart option |
| 618 |
containers.podman.podman_container: |
| 619 |
executable: "{{ test_executable | default('podman') }}" |
| 620 |
name: testidem |
| 621 |
image: alpine:latest |
| 622 |
state: started |
| 623 |
command: sleep 20m |
| 624 |
register: idem_r1 |
| 625 |
|
| 626 |
- name: Check that task was not changed |
| 627 |
assert: |
| 628 |
that: |
| 629 |
- idem_r1 is not changed |
| 630 |
|
| 631 |
- name: Run changed container (with tty enabled) |
| 632 |
containers.podman.podman_container: |
| 633 |
executable: "{{ test_executable | default('podman') }}" |
| 634 |
name: testidem |
| 635 |
image: alpine |
| 636 |
state: started |
| 637 |
command: sleep 20m |
| 638 |
tty: true |
| 639 |
register: idem1 |
| 640 |
|
| 641 |
- name: Check that container is recreated when changed |
| 642 |
assert: |
| 643 |
that: |
| 644 |
- idem1 is changed |
| 645 |
|
| 646 |
- name: Run changed container without specifying an option, use defaults |
| 647 |
containers.podman.podman_container: |
| 648 |
executable: "{{ test_executable | default('podman') }}" |
| 649 |
name: testidem |
| 650 |
image: alpine |
| 651 |
state: started |
| 652 |
command: sleep 20m |
| 653 |
register: idem2 |
| 654 |
|
| 655 |
- name: Check that container is recreated when changed to default value |
| 656 |
assert: |
| 657 |
that: |
| 658 |
- idem2 is changed |
| 659 |
|
| 660 |
- name: Remove container |
| 661 |
containers.podman.podman_container: |
| 662 |
executable: "{{ test_executable | default('podman') }}" |
| 663 |
name: testidem |
| 664 |
state: absent |
| 665 |
register: remove |
| 666 |
|
| 667 |
- name: Check podman_actions |
| 668 |
assert: |
| 669 |
that: |
| 670 |
- "'podman rm --force testidem' in remove.podman_actions" |
| 671 |
|
| 672 |
# - name: Create a pod |
| 673 |
# shell: podman pod create --name testidempod |
| 674 |
|
| 675 |
- name: Check basic idempotency of pod container |
| 676 |
containers.podman.podman_container: |
| 677 |
executable: "{{ test_executable | default('podman') }}" |
| 678 |
name: testidem-pod |
| 679 |
image: docker.io/alpine |
| 680 |
state: started |
| 681 |
command: sleep 20m |
| 682 |
pod: "new:testidempod" |
| 683 |
|
| 684 |
- name: Check basic idempotency of pod container - run it again |
| 685 |
containers.podman.podman_container: |
| 686 |
executable: "{{ test_executable | default('podman') }}" |
| 687 |
name: testidem-pod |
| 688 |
image: alpine:latest |
| 689 |
state: started |
| 690 |
command: sleep 20m |
| 691 |
pod: testidempod |
| 692 |
register: idem3 |
| 693 |
|
| 694 |
- name: Check that nothing was changed in pod containers |
| 695 |
assert: |
| 696 |
that: |
| 697 |
- not idem3.changed |
| 698 |
|
| 699 |
- name: Run changed pod container (with tty enabled) |
| 700 |
containers.podman.podman_container: |
| 701 |
executable: "{{ test_executable | default('podman') }}" |
| 702 |
name: testidem-pod |
| 703 |
image: alpine |
| 704 |
state: started |
| 705 |
command: sleep 20m |
| 706 |
tty: true |
| 707 |
pod: testidempod |
| 708 |
register: idem4 |
| 709 |
|
| 710 |
- name: Check that container is recreated when changed |
| 711 |
assert: |
| 712 |
that: |
| 713 |
- idem4 is changed |
| 714 |
- idem4.podman_systemd.keys() | list | length > 0 |
| 715 |
- idem4.podman_systemd.values() | list | length > 0 |
| 716 |
|
| 717 |
- name: Run container with systemd generation parameters v4 |
| 718 |
containers.podman.podman_container: |
| 719 |
executable: "{{ test_executable | default('podman') }}" |
| 720 |
name: container1 |
| 721 |
image: alpine |
| 722 |
state: started |
| 723 |
command: sleep 20m |
| 724 |
generate_systemd: |
| 725 |
path: /tmp/ |
| 726 |
restart_policy: always |
| 727 |
no_header: true |
| 728 |
names: true |
| 729 |
pod_prefix: whocares |
| 730 |
separator: zzzz |
| 731 |
container_prefix: contain |
| 732 |
restart_sec: 10 |
| 733 |
start_timeout: 20 |
| 734 |
stop_timeout: 15 |
| 735 |
register: system14 |
| 736 |
when: podman_version == 4 |
| 737 |
|
| 738 |
- name: Run container with systemd generation parameters v3 |
| 739 |
containers.podman.podman_container: |
| 740 |
executable: "{{ test_executable | default('podman') }}" |
| 741 |
name: container1 |
| 742 |
image: alpine |
| 743 |
state: started |
| 744 |
command: sleep 20m |
| 745 |
generate_systemd: |
| 746 |
path: /tmp/ |
| 747 |
time: 120 |
| 748 |
restart_policy: always |
| 749 |
no_header: true |
| 750 |
names: true |
| 751 |
pod_prefix: whocares |
| 752 |
separator: zzzz |
| 753 |
container_prefix: contain |
| 754 |
register: system13 |
| 755 |
when: podman_version == 3 |
| 756 |
|
| 757 |
- name: Check service file presents |
| 758 |
stat: |
| 759 |
path: /tmp/containzzzzcontainer1.service |
| 760 |
register: service_file |
| 761 |
|
| 762 |
- name: Check that container has correct systemd output v4 and quadlet |
| 763 |
assert: |
| 764 |
that: |
| 765 |
- system14.podman_systemd.keys() | list | first == 'containzzzzcontainer1' |
| 766 |
- system14.podman_systemd.values() | list | length > 0 |
| 767 |
- service_file.stat.exists | bool |
| 768 |
- "'Restart=always' in system14.podman_systemd.values() | list | first" |
| 769 |
- "'autogenerated by Podman' not in system14.podman_systemd.values() | list | first" |
| 770 |
- "'RestartSec=10' in system14.podman_systemd.values() | list | first" |
| 771 |
- "'TimeoutStartSec=20' in system14.podman_systemd.values() | list | first" |
| 772 |
- system14.podman_quadlet | length > 0 |
| 773 |
- system14.podman_quadlet | length > 0 |
| 774 |
- "'ContainerName=container1' in system14.podman_quadlet" |
| 775 |
- "'Image=alpine' in system14.podman_quadlet" |
| 776 |
|
| 777 |
when: podman_version == 4 |
| 778 |
|
| 779 |
- name: Check that container has correct systemd output v3 |
| 780 |
assert: |
| 781 |
that: |
| 782 |
- system13.podman_systemd.keys() | list | first == 'containzzzzcontainer1' |
| 783 |
- system13.podman_systemd.values() | list | length > 0 |
| 784 |
- service_file.stat.exists | bool |
| 785 |
- "'Restart=always' in system13.podman_systemd.values() | list | first" |
| 786 |
- "'autogenerated by Podman' not in system13.podman_systemd.values() | list | first" |
| 787 |
- "'-t 120 ' in system13.podman_systemd.values() | list | first" |
| 788 |
when: podman_version == 3 |
| 789 |
|
| 790 |
- name: Delete container with systemd generation parameters v3 |
| 791 |
containers.podman.podman_container: |
| 792 |
executable: "{{ test_executable | default('podman') }}" |
| 793 |
name: container1 |
| 794 |
image: alpine |
| 795 |
state: absent |
| 796 |
command: sleep 20m |
| 797 |
generate_systemd: |
| 798 |
path: /tmp/ |
| 799 |
time: 120 |
| 800 |
restart_policy: always |
| 801 |
no_header: true |
| 802 |
names: true |
| 803 |
pod_prefix: whocares |
| 804 |
separator: zzzz |
| 805 |
container_prefix: contain |
| 806 |
register: system1 |
| 807 |
when: podman_version == 3 |
| 808 |
|
| 809 |
- name: Delete container with systemd generation parameters v4 |
| 810 |
containers.podman.podman_container: |
| 811 |
executable: "{{ test_executable | default('podman') }}" |
| 812 |
name: container1 |
| 813 |
image: alpine |
| 814 |
state: absent |
| 815 |
command: sleep 20m |
| 816 |
generate_systemd: |
| 817 |
path: /tmp/ |
| 818 |
restart_policy: always |
| 819 |
no_header: true |
| 820 |
names: true |
| 821 |
pod_prefix: whocares |
| 822 |
separator: zzzz |
| 823 |
container_prefix: contain |
| 824 |
restart_sec: 10 |
| 825 |
start_timeout: 20 |
| 826 |
stop_timeout: 15 |
| 827 |
register: system1 |
| 828 |
when: podman_version == 4 |
| 829 |
|
| 830 |
- name: Check service file doesn't present |
| 831 |
stat: |
| 832 |
path: /tmp/containzzzzcontainer1.service |
| 833 |
register: service2_file |
| 834 |
|
| 835 |
- name: Check that service file was deleted |
| 836 |
assert: |
| 837 |
that: |
| 838 |
- not service2_file.stat.exists | bool |
| 839 |
|
| 840 |
- name: Create environment variables files |
| 841 |
copy: |
| 842 |
dest: /tmp/envfile |
| 843 |
content: | |
| 844 |
FOO=bar |
| 845 |
BAR=foo |
| 846 |
TEST=1 |
| 847 |
BOOL=false |
| 848 |
|
| 849 |
- name: Create another environment variables files |
| 850 |
copy: |
| 851 |
dest: /tmp/envfile2 |
| 852 |
content: | |
| 853 |
TESTVAR=qwerty |
| 854 |
|
| 855 |
- name: Create container with environment variables file |
| 856 |
containers.podman.podman_container: |
| 857 |
executable: "{{ test_executable | default('podman') }}" |
| 858 |
name: container1 |
| 859 |
image: alpine |
| 860 |
state: started |
| 861 |
command: |
| 862 |
- sh |
| 863 |
- -c |
| 864 |
- echo $BAR |
| 865 |
attach: |
| 866 |
- stdout |
| 867 |
- stderr |
| 868 |
env_file: /tmp/envfile |
| 869 |
register: envfile |
| 870 |
|
| 871 |
- name: Check output is correct for env file |
| 872 |
assert: |
| 873 |
that: |
| 874 |
- envfile.stdout == "foo\n" |
| 875 |
|
| 876 |
- name: Create container with multiple environment variables files |
| 877 |
containers.podman.podman_container: |
| 878 |
executable: "{{ test_executable | default('podman') }}" |
| 879 |
name: container1 |
| 880 |
image: alpine |
| 881 |
state: started |
| 882 |
command: |
| 883 |
- sh |
| 884 |
- -c |
| 885 |
- echo $TESTVAR |
| 886 |
attach: |
| 887 |
- stdout |
| 888 |
- stderr |
| 889 |
env_file: |
| 890 |
- /tmp/envfile |
| 891 |
- /tmp/envfile2 |
| 892 |
register: envfile2 |
| 893 |
|
| 894 |
- name: Check output is correct for multiple env files |
| 895 |
assert: |
| 896 |
that: |
| 897 |
- envfile2.stdout == "qwerty\n" |
| 898 |
|
| 899 |
- name: Delete container with environment variables file |
| 900 |
containers.podman.podman_container: |
| 901 |
executable: "{{ test_executable | default('podman') }}" |
| 902 |
name: container1 |
| 903 |
state: absent |
| 904 |
|
| 905 |
- name: Rootfs container tests |
| 906 |
tags: |
| 907 |
- no_build_version |
| 908 |
block: |
| 909 |
|
| 910 |
- name: Create temporary rootfs directory |
| 911 |
ansible.builtin.tempfile: |
| 912 |
state: directory |
| 913 |
suffix: container-rootfs |
| 914 |
register: container_tempdir |
| 915 |
- name: Debug container_tempdir |
| 916 |
ansible.builtin.debug: |
| 917 |
var: container_tempdir |
| 918 |
|
| 919 |
|
| 920 |
- name: Download alpine releases file |
| 921 |
ansible.builtin.get_url: |
| 922 |
url: "https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/{{ ansible_architecture }}/latest-releases.yaml" |
| 923 |
dest: "{{ container_tempdir.path }}/latest-releases.yaml" |
| 924 |
register: alpine_releases_file |
| 925 |
|
| 926 |
- name: Get content of alpine releases file |
| 927 |
ansible.builtin.slurp: |
| 928 |
src: "{{ container_tempdir.path }}/latest-releases.yaml" |
| 929 |
register: latest_releases_file |
| 930 |
|
| 931 |
- name: Download alpine latest rootfs |
| 932 |
vars: |
| 933 |
latest_releases: "{{ latest_releases_file.content | b64decode }}" |
| 934 |
latest_version: "{{ (latest_releases | from_yaml)[0].version }}" |
| 935 |
latest_branch: "{{ (latest_releases | from_yaml)[0].branch }}" |
| 936 |
ansible.builtin.unarchive: |
| 937 |
src: "https://dl-cdn.alpinelinux.org/alpine/{{ latest_branch }}/releases/{{ ansible_architecture }}/alpine-minirootfs-{{ latest_version }}-{{ ansible_architecture }}.tar.gz" |
| 938 |
dest: "{{ container_tempdir.path }}" |
| 939 |
remote_src: true |
| 940 |
|
| 941 |
- name: Check invalid rootfs image pull |
| 942 |
containers.podman.podman_container: |
| 943 |
executable: "{{ test_executable | default('podman') }}" |
| 944 |
name: container |
| 945 |
image: /ineverneverneverexist |
| 946 |
rootfs: true |
| 947 |
state: started |
| 948 |
command: sleep 1d |
| 949 |
register: imagerootfsfail |
| 950 |
ignore_errors: true |
| 951 |
|
| 952 |
- name: Check output is correct |
| 953 |
assert: |
| 954 |
that: |
| 955 |
- imagerootfsfail is failed |
| 956 |
- imagerootfsfail.msg == "Image rootfs doesn't exist /ineverneverneverexist" |
| 957 |
|
| 958 |
- name: Check rootfs container |
| 959 |
containers.podman.podman_container: |
| 960 |
executable: "{{ test_executable | default('podman') }}" |
| 961 |
name: container3 |
| 962 |
image: "{{ container_tempdir.path }}" |
| 963 |
rootfs: true |
| 964 |
state: started |
| 965 |
command: sleep 1d |
| 966 |
register: image |
| 967 |
|
| 968 |
- name: Check output is correct |
| 969 |
assert: |
| 970 |
that: |
| 971 |
- image is changed |
| 972 |
- image.container is defined |
| 973 |
- image.container['State']['Running'] |
| 974 |
- image.container['Image'] == "" |
| 975 |
- image.container['Rootfs'] == container_tempdir.path |
| 976 |
- "'started container3' in image.actions" |
| 977 |
fail_msg: Rootfs container test failed! |
| 978 |
success_msg: Rootfs container test passed! |
| 979 |
|
| 980 |
- name: Check basic idempotency of running rootfs container - run it again |
| 981 |
containers.podman.podman_container: |
| 982 |
executable: "{{ test_executable | default('podman') }}" |
| 983 |
name: container3 |
| 984 |
image: "{{ container_tempdir.path }}" |
| 985 |
rootfs: true |
| 986 |
state: started |
| 987 |
command: sleep 1d |
| 988 |
register: idem |
| 989 |
|
| 990 |
- name: Check that nothing was changed |
| 991 |
assert: |
| 992 |
that: |
| 993 |
- not idem.changed |
| 994 |
|
| 995 |
- name: Rebuild rootfs container with image |
| 996 |
containers.podman.podman_container: |
| 997 |
executable: "{{ test_executable | default('podman') }}" |
| 998 |
name: container3 |
| 999 |
image: alpine:3.7 |
| 1000 |
state: started |
| 1001 |
command: sleep 1d |
| 1002 |
register: image |
| 1003 |
|
| 1004 |
- name: Debug image |
| 1005 |
ansible.builtin.debug: |
| 1006 |
var: image |
| 1007 |
|
| 1008 |
- name: Check output is correct |
| 1009 |
assert: |
| 1010 |
that: |
| 1011 |
- image is changed |
| 1012 |
- image.container is defined |
| 1013 |
- image.container['State']['Running'] |
| 1014 |
- image.container['Rootfs'] == "" |
| 1015 |
- "'alpine:3.7' in image.container['ImageName']" |
| 1016 |
- "'recreated container3' in image.actions" |
| 1017 |
fail_msg: Rootfs container test failed! |
| 1018 |
success_msg: Rootfs container test passed! |
| 1019 |
|
| 1020 |
- name: Rebuild container with rootfs again |
| 1021 |
containers.podman.podman_container: |
| 1022 |
executable: "{{ test_executable | default('podman') }}" |
| 1023 |
name: container3 |
| 1024 |
image: "{{ container_tempdir.path }}" |
| 1025 |
rootfs: true |
| 1026 |
state: started |
| 1027 |
command: sleep 1d |
| 1028 |
register: image |
| 1029 |
|
| 1030 |
- name: Check output is correct |
| 1031 |
assert: |
| 1032 |
that: |
| 1033 |
- image is changed |
| 1034 |
- image.container is defined |
| 1035 |
- image.container['State']['Running'] |
| 1036 |
- image.container['Image'] == "" |
| 1037 |
- image.container['Rootfs'] == container_tempdir.path |
| 1038 |
- "'recreated container3' in image.actions" |
| 1039 |
fail_msg: Rootfs container test failed! |
| 1040 |
success_msg: Rootfs container test passed! |
| 1041 |
|
| 1042 |
- name: Run started container with attaching |
| 1043 |
containers.podman.podman_container: |
| 1044 |
executable: "{{ test_executable | default('podman') }}" |
| 1045 |
name: container1 |
| 1046 |
image: alpine:3.7 |
| 1047 |
state: started |
| 1048 |
command: ls /nonexists |
| 1049 |
attach: |
| 1050 |
- stdout |
| 1051 |
- stderr |
| 1052 |
register: attach |
| 1053 |
ignore_errors: true |
| 1054 |
|
| 1055 |
- name: Check output is correct for started container with attaching |
| 1056 |
assert: |
| 1057 |
that: |
| 1058 |
- attach is failed |
| 1059 |
- "'No such file or directory' in attach.stderr" |
| 1060 |
|
| 1061 |
- name: Delete container with attaching |
| 1062 |
containers.podman.podman_container: |
| 1063 |
executable: "{{ test_executable | default('podman') }}" |
| 1064 |
name: container1 |
| 1065 |
state: absent |
| 1066 |
|
| 1067 |
- name: Create container with attaching in created state |
| 1068 |
containers.podman.podman_container: |
| 1069 |
executable: "{{ test_executable | default('podman') }}" |
| 1070 |
name: container1 |
| 1071 |
image: alpine:3.7 |
| 1072 |
state: created |
| 1073 |
command: ls /nonexists |
| 1074 |
attach: |
| 1075 |
- stdout |
| 1076 |
- stderr |
| 1077 |
|
| 1078 |
- name: Start container with attaching from created state |
| 1079 |
containers.podman.podman_container: |
| 1080 |
executable: "{{ test_executable | default('podman') }}" |
| 1081 |
name: container1 |
| 1082 |
state: started |
| 1083 |
attach: |
| 1084 |
- stdout |
| 1085 |
- stderr |
| 1086 |
register: attach2 |
| 1087 |
ignore_errors: true |
| 1088 |
|
| 1089 |
- name: Check output is correct for started container with attaching from created state |
| 1090 |
assert: |
| 1091 |
that: |
| 1092 |
- attach2 is failed |
| 1093 |
- "'No such file or directory' in attach2.stderr" |
| 1094 |
|
| 1095 |
- name: Delete container with attaching from created state |
| 1096 |
containers.podman.podman_container: |
| 1097 |
executable: "{{ test_executable | default('podman') }}" |
| 1098 |
name: container1 |
| 1099 |
state: absent |
| 1100 |
|
| 1101 |
- name: Create container without attaching in created state |
| 1102 |
containers.podman.podman_container: |
| 1103 |
executable: "{{ test_executable | default('podman') }}" |
| 1104 |
name: container1 |
| 1105 |
image: alpine:3.7 |
| 1106 |
state: created |
| 1107 |
command: ls /nonexists |
| 1108 |
|
| 1109 |
- name: Start container without attaching from created state |
| 1110 |
containers.podman.podman_container: |
| 1111 |
executable: "{{ test_executable | default('podman') }}" |
| 1112 |
name: container1 |
| 1113 |
state: started |
| 1114 |
register: attach21 |
| 1115 |
|
| 1116 |
- name: Check output is correct for container without attaching from created state |
| 1117 |
assert: |
| 1118 |
that: |
| 1119 |
- attach21 is success |
| 1120 |
|
| 1121 |
- name: Delete container without attaching from created state |
| 1122 |
containers.podman.podman_container: |
| 1123 |
executable: "{{ test_executable | default('podman') }}" |
| 1124 |
name: container1 |
| 1125 |
state: absent |
| 1126 |
|
| 1127 |
- name: Create container with detach False |
| 1128 |
containers.podman.podman_container: |
| 1129 |
executable: "{{ test_executable | default('podman') }}" |
| 1130 |
name: container1 |
| 1131 |
image: alpine:3.7 |
| 1132 |
state: created |
| 1133 |
command: ls /nonexists |
| 1134 |
detach: false |
| 1135 |
|
| 1136 |
- name: Start container with detach False |
| 1137 |
containers.podman.podman_container: |
| 1138 |
executable: "{{ test_executable | default('podman') }}" |
| 1139 |
name: container1 |
| 1140 |
state: started |
| 1141 |
detach: false |
| 1142 |
register: attach3 |
| 1143 |
ignore_errors: true |
| 1144 |
|
| 1145 |
- name: Check output is correct for started container with detach False |
| 1146 |
assert: |
| 1147 |
that: |
| 1148 |
- attach3 is failed |
| 1149 |
- "'No such file or directory' in attach3.stderr" |
| 1150 |
|
| 1151 |
- name: Create a Quadlet for container with filename |
| 1152 |
containers.podman.podman_container: |
| 1153 |
executable: "{{ test_executable | default('podman') }}" |
| 1154 |
name: container-quadlet |
| 1155 |
image: alpine |
| 1156 |
state: quadlet |
| 1157 |
quadlet_dir: /tmp |
| 1158 |
quadlet_filename: customfile |
| 1159 |
|
| 1160 |
- name: Check if files exists |
| 1161 |
stat: |
| 1162 |
path: /tmp/customfile.container |
| 1163 |
register: quadlet_file_custom |
| 1164 |
|
| 1165 |
- name: Fail if no file is present |
| 1166 |
assert: |
| 1167 |
that: |
| 1168 |
- quadlet_file_custom.stat.exists |
| 1169 |
|
| 1170 |
- name: Create a Quadlet for container with filename w/o dir |
| 1171 |
containers.podman.podman_container: |
| 1172 |
executable: "{{ test_executable | default('podman') }}" |
| 1173 |
name: container-quadlet |
| 1174 |
image: alpine |
| 1175 |
state: quadlet |
| 1176 |
quadlet_filename: container11.container |
| 1177 |
|
| 1178 |
- name: Check if files exists |
| 1179 |
stat: |
| 1180 |
path: ~/.config/containers/systemd/container11.container |
| 1181 |
register: quadlet_file_custom2 |
| 1182 |
|
| 1183 |
- name: Fail if no file is present |
| 1184 |
assert: |
| 1185 |
that: |
| 1186 |
- quadlet_file_custom2.stat.exists |
| 1187 |
|
| 1188 |
- name: Create a Quadlet for container with filename w/o dir |
| 1189 |
containers.podman.podman_container: |
| 1190 |
executable: "{{ test_executable | default('podman') }}" |
| 1191 |
name: container-quadlet |
| 1192 |
image: alpine |
| 1193 |
state: quadlet |
| 1194 |
|
| 1195 |
- name: Check if files exists |
| 1196 |
stat: |
| 1197 |
path: ~/.config/containers/systemd/container-quadlet.container |
| 1198 |
register: quadlet_file_custom3 |
| 1199 |
|
| 1200 |
- name: Fail if no file is present |
| 1201 |
assert: |
| 1202 |
that: |
| 1203 |
- quadlet_file_custom3.stat.exists |
| 1204 |
|
| 1205 |
- name: Fail if wrong default file mode |
| 1206 |
assert: |
| 1207 |
that: |
| 1208 |
- quadlet_file_custom3.stat.mode == '0640' |
| 1209 |
|
| 1210 |
- name: Create a Quadlet for container with file mode |
| 1211 |
containers.podman.podman_container: |
| 1212 |
executable: "{{ test_executable | default('podman') }}" |
| 1213 |
name: container-quadlet-mode |
| 1214 |
image: alpine |
| 1215 |
state: quadlet |
| 1216 |
quadlet_file_mode: '0644' |
| 1217 |
|
| 1218 |
- name: Check file mode |
| 1219 |
stat: |
| 1220 |
path: ~/.config/containers/systemd/container-quadlet-mode.container |
| 1221 |
register: quadlet_file_mode1 |
| 1222 |
|
| 1223 |
- name: Fail if file is present and with correct mode |
| 1224 |
assert: |
| 1225 |
that: |
| 1226 |
- quadlet_file_mode1.stat.exists |
| 1227 |
- quadlet_file_mode1.stat.mode == '0644' |
| 1228 |
|
| 1229 |
- name: Create same Quadlet for container without file mode |
| 1230 |
containers.podman.podman_container: |
| 1231 |
executable: "{{ test_executable | default('podman') }}" |
| 1232 |
name: container-quadlet-mode |
| 1233 |
image: alpine |
| 1234 |
state: quadlet |
| 1235 |
register: quad_mode2 |
| 1236 |
|
| 1237 |
- name: Check file mode |
| 1238 |
stat: |
| 1239 |
path: ~/.config/containers/systemd/container-quadlet-mode.container |
| 1240 |
register: quadlet_file_mode2 |
| 1241 |
|
| 1242 |
- name: Check if existing mode is preserve |
| 1243 |
assert: |
| 1244 |
that: |
| 1245 |
- quad_mode2 is not changed |
| 1246 |
- quadlet_file_mode2.stat.mode == '0644' |
| 1247 |
|
| 1248 |
- name: Create same Quadlet for container with only file mode changed |
| 1249 |
containers.podman.podman_container: |
| 1250 |
executable: "{{ test_executable | default('podman') }}" |
| 1251 |
name: container-quadlet-mode |
| 1252 |
image: alpine |
| 1253 |
state: quadlet |
| 1254 |
quadlet_file_mode: '0640' |
| 1255 |
register: quad_mode3 |
| 1256 |
|
| 1257 |
- name: Check file mode |
| 1258 |
stat: |
| 1259 |
path: ~/.config/containers/systemd/container-quadlet-mode.container |
| 1260 |
register: quadlet_file_mode3 |
| 1261 |
|
| 1262 |
- name: Fail if file is present and with correct mode |
| 1263 |
assert: |
| 1264 |
that: |
| 1265 |
- quad_mode3 is changed |
| 1266 |
- quadlet_file_mode3.stat.mode == '0640' |
| 1267 |
|
| 1268 |
- name: Create a Quadlet for container |
| 1269 |
containers.podman.podman_container: |
| 1270 |
executable: "{{ test_executable | default('podman') }}" |
| 1271 |
name: container-quadlet |
| 1272 |
image: alpine:3.12 |
| 1273 |
state: quadlet |
| 1274 |
quadlet_dir: /tmp |
| 1275 |
command: sleep 1d |
| 1276 |
recreate: true |
| 1277 |
stop_signal: 9 #SIGKILL |
| 1278 |
group_add: |
| 1279 |
- admin |
| 1280 |
- users |
| 1281 |
etc_hosts: |
| 1282 |
host1: 127.0.0.1 |
| 1283 |
host2: 127.0.0.1 |
| 1284 |
network_aliases: |
| 1285 |
- web |
| 1286 |
- db |
| 1287 |
cpus: 0.5 |
| 1288 |
platform: linux/amd64 |
| 1289 |
annotation: |
| 1290 |
this: "annotation_value" |
| 1291 |
dns: |
| 1292 |
- 1.1.1.1 |
| 1293 |
- 8.8.4.4 |
| 1294 |
dns_search: example.com |
| 1295 |
cap_add: |
| 1296 |
- SYS_TIME |
| 1297 |
- NET_ADMIN |
| 1298 |
publish: |
| 1299 |
- "9000:80" |
| 1300 |
- "9001:8000" |
| 1301 |
workdir: "/bin" |
| 1302 |
env: |
| 1303 |
FOO: bar=1 |
| 1304 |
BAR: foo |
| 1305 |
TEST: 1 |
| 1306 |
BOOL: false |
| 1307 |
WITH_SPACES: "a nice string" |
| 1308 |
label: |
| 1309 |
somelabel: labelvalue |
| 1310 |
otheralbe: othervalue |
| 1311 |
spacelabel: "a nice label" |
| 1312 |
log_opt: |
| 1313 |
max_size: 10mb |
| 1314 |
path: /var/log/container/mycontainer.json |
| 1315 |
tag: TestTag |
| 1316 |
volumes: |
| 1317 |
- /tmp:/data |
| 1318 |
cgroups: no-conmon |
| 1319 |
mounts: |
| 1320 |
- type=devpts,destination=/dev/pts |
| 1321 |
quadlet_options: |
| 1322 |
- AutoUpdate=registry |
| 1323 |
- Unmask=ALL |
| 1324 |
- SecurityLabelFileType=usr_t |
| 1325 |
- Annotation=key1=annotation_value1 |
| 1326 |
- Annotation=key2=annotation_value2 |
| 1327 |
- | |
| 1328 |
[Install] |
| 1329 |
WantedBy=default.target |
| 1330 |
|
| 1331 |
- name: Check if files exists |
| 1332 |
stat: |
| 1333 |
path: /tmp/container-quadlet.container |
| 1334 |
register: quadlet_file |
| 1335 |
|
| 1336 |
- name: Check output is correct for Quadlet container in /tmp/container-quadlet.container file |
| 1337 |
assert: |
| 1338 |
that: |
| 1339 |
- quadlet_file.stat.exists |
| 1340 |
|
| 1341 |
- name: Check for the existence of lines in /tmp/container-quadlet.container |
| 1342 |
lineinfile: |
| 1343 |
path: /tmp/container-quadlet.container |
| 1344 |
line: "{{ item }}" |
| 1345 |
state: present |
| 1346 |
check_mode: yes |
| 1347 |
register: line_check |
| 1348 |
loop: |
| 1349 |
- "[Container]" |
| 1350 |
- "Annotation=this=annotation_value" |
| 1351 |
- "Annotation=key1=annotation_value1" |
| 1352 |
- "Annotation=key2=annotation_value2" |
| 1353 |
- "ContainerName=container-quadlet" |
| 1354 |
- "Image=alpine:3.12" |
| 1355 |
- "Exec=sleep 1d" |
| 1356 |
- "Volume=/tmp:/data" |
| 1357 |
- "CgroupsMode=no-conmon" |
| 1358 |
- "Mount=type=devpts,destination=/dev/pts" |
| 1359 |
- "WorkingDir=/bin" |
| 1360 |
- "Unmask=ALL" |
| 1361 |
- "SecurityLabelFileType=usr_t" |
| 1362 |
- "Environment=BOOL=False" |
| 1363 |
- "Environment='WITH_SPACES=a nice string'" |
| 1364 |
- "PublishPort=9001:8000" |
| 1365 |
- "AddHost=host2:127.0.0.1" |
| 1366 |
- "Label=somelabel=labelvalue" |
| 1367 |
- "Label='spacelabel=a nice label'" |
| 1368 |
- "WantedBy=default.target" |
| 1369 |
- "GroupAdd=admin" |
| 1370 |
- "GroupAdd=users" |
| 1371 |
- "NetworkAlias=web" |
| 1372 |
- "NetworkAlias=db" |
| 1373 |
- "StopSignal=9" |
| 1374 |
- "PodmanArgs=--cpus 0.5" |
| 1375 |
- "PodmanArgs=--platform linux/amd64" |
| 1376 |
- "LogOpt=max-size=10mb" |
| 1377 |
- "LogOpt=path=/var/log/container/mycontainer.json" |
| 1378 |
- "LogOpt=tag=TestTag" |
| 1379 |
loop_control: |
| 1380 |
label: "{{ item }}" |
| 1381 |
|
| 1382 |
- name: Fail the task if any line is not present |
| 1383 |
fail: |
| 1384 |
msg: "The following line is not present in /tmp/container-quadlet.container: {{ item.item }}" |
| 1385 |
when: item.changed |
| 1386 |
loop: "{{ line_check.results }}" |
| 1387 |
loop_control: |
| 1388 |
label: "{{ item.item }}" |
| 1389 |
|
| 1390 |
- name: Create a Quadlet for container - same |
| 1391 |
containers.podman.podman_container: |
| 1392 |
executable: "{{ test_executable | default('podman') }}" |
| 1393 |
name: container-quadlet |
| 1394 |
image: alpine:3.12 |
| 1395 |
state: quadlet |
| 1396 |
quadlet_dir: /tmp |
| 1397 |
command: sleep 1d |
| 1398 |
recreate: true |
| 1399 |
stop_signal: 9 #SIGKILL |
| 1400 |
group_add: |
| 1401 |
- admin |
| 1402 |
- users |
| 1403 |
etc_hosts: |
| 1404 |
host1: 127.0.0.1 |
| 1405 |
host2: 127.0.0.1 |
| 1406 |
network_aliases: |
| 1407 |
- web |
| 1408 |
- db |
| 1409 |
cpus: 0.5 |
| 1410 |
platform: linux/amd64 |
| 1411 |
annotation: |
| 1412 |
this: "annotation_value" |
| 1413 |
dns: |
| 1414 |
- 1.1.1.1 |
| 1415 |
- 8.8.4.4 |
| 1416 |
dns_search: example.com |
| 1417 |
cap_add: |
| 1418 |
- SYS_TIME |
| 1419 |
- NET_ADMIN |
| 1420 |
publish: |
| 1421 |
- "9000:80" |
| 1422 |
- "9001:8000" |
| 1423 |
workdir: "/bin" |
| 1424 |
env: |
| 1425 |
FOO: bar=1 |
| 1426 |
BAR: foo |
| 1427 |
TEST: 1 |
| 1428 |
BOOL: false |
| 1429 |
WITH_SPACES: "a nice string" |
| 1430 |
label: |
| 1431 |
somelabel: labelvalue |
| 1432 |
otheralbe: othervalue |
| 1433 |
spacelabel: "a nice label" |
| 1434 |
log_opt: |
| 1435 |
max_size: 10mb |
| 1436 |
path: /var/log/container/mycontainer.json |
| 1437 |
tag: TestTag |
| 1438 |
volumes: |
| 1439 |
- /tmp:/data |
| 1440 |
cgroups: no-conmon |
| 1441 |
mounts: |
| 1442 |
- type=devpts,destination=/dev/pts |
| 1443 |
quadlet_options: |
| 1444 |
- AutoUpdate=registry |
| 1445 |
- Unmask=ALL |
| 1446 |
- SecurityLabelFileType=usr_t |
| 1447 |
- Annotation=key1=annotation_value1 |
| 1448 |
- Annotation=key2=annotation_value2 |
| 1449 |
- | |
| 1450 |
[Install] |
| 1451 |
WantedBy=default.target |
| 1452 |
register: quad2 |
| 1453 |
|
| 1454 |
- name: Check if quadlet changed |
| 1455 |
assert: |
| 1456 |
that: |
| 1457 |
- quad2 is not changed |
| 1458 |
|
| 1459 |
- name: Create a Quadlet for container - different |
| 1460 |
containers.podman.podman_container: |
| 1461 |
executable: "{{ test_executable | default('podman') }}" |
| 1462 |
name: container-quadlet |
| 1463 |
image: alpine:3.12 |
| 1464 |
state: quadlet |
| 1465 |
quadlet_dir: /tmp |
| 1466 |
command: sleep 1d |
| 1467 |
recreate: true |
| 1468 |
stop_signal: 9 #SIGKILL |
| 1469 |
group_add: |
| 1470 |
- admin |
| 1471 |
- users |
| 1472 |
etc_hosts: |
| 1473 |
host1: 127.0.0.45 |
| 1474 |
host2: 127.0.0.1 |
| 1475 |
network_aliases: |
| 1476 |
- web |
| 1477 |
- db |
| 1478 |
cpus: 0.5 |
| 1479 |
platform: linux/amd64 |
| 1480 |
annotation: |
| 1481 |
this: "annotation_value" |
| 1482 |
dns: |
| 1483 |
- 1.1.1.1 |
| 1484 |
- 8.8.4.4 |
| 1485 |
dns_search: example.com |
| 1486 |
cap_add: |
| 1487 |
- SYS_TIME |
| 1488 |
- NET_ADMIN |
| 1489 |
publish: |
| 1490 |
- "9000:80" |
| 1491 |
- "9001:8000" |
| 1492 |
workdir: "/bin" |
| 1493 |
env: |
| 1494 |
FOO: bar=1 |
| 1495 |
BAR: foo |
| 1496 |
TEST: 1 |
| 1497 |
BOOL: false |
| 1498 |
label: |
| 1499 |
somelabel: labelvalue |
| 1500 |
otheralbe: othervalue |
| 1501 |
log_opt: |
| 1502 |
max_size: 10mb |
| 1503 |
path: /var/log/container/mycontainer.json |
| 1504 |
tag: TestTag |
| 1505 |
volumes: |
| 1506 |
- /tmp:/data |
| 1507 |
cgroups: no-conmon |
| 1508 |
mounts: |
| 1509 |
- type=devpts,destination=/dev/pts |
| 1510 |
quadlet_options: |
| 1511 |
- AutoUpdate=registry |
| 1512 |
- Unmask=ALL |
| 1513 |
- SecurityLabelFileType=usr_t |
| 1514 |
- Annotation=key1=annotation_value1 |
| 1515 |
- Annotation=key2=annotation_value2 |
| 1516 |
- | |
| 1517 |
[Install] |
| 1518 |
WantedBy=default.target |
| 1519 |
register: quad3 |
| 1520 |
|
| 1521 |
- name: Print diff |
| 1522 |
debug: |
| 1523 |
var: quad3.diff |
| 1524 |
|
| 1525 |
- name: Check if changed and diff |
| 1526 |
assert: |
| 1527 |
that: |
| 1528 |
- quad3 is changed |
| 1529 |
- "'127.0.0.45' in quad3.diff.after" |
| 1530 |
|
| 1531 |
# Test for issue #913: restart_policy should go to [Service] section, not PodmanArgs |
| 1532 |
- name: Create a Quadlet for container with restart_policy |
| 1533 |
containers.podman.podman_container: |
| 1534 |
executable: "{{ test_executable | default('podman') }}" |
| 1535 |
name: container-restart-test |
| 1536 |
image: alpine |
| 1537 |
state: quadlet |
| 1538 |
quadlet_dir: /tmp |
| 1539 |
restart_policy: always |
| 1540 |
register: quad_restart |
| 1541 |
|
| 1542 |
- name: Check if Quadlet file contains [Service] section with Restart |
| 1543 |
shell: cat /tmp/container-restart-test.container |
| 1544 |
register: quad_restart_content |
| 1545 |
|
| 1546 |
- name: Verify restart_policy is in [Service] section and not in PodmanArgs |
| 1547 |
assert: |
| 1548 |
that: |
| 1549 |
- quad_restart is changed |
| 1550 |
- "'[Service]' in quad_restart_content.stdout" |
| 1551 |
- "'Restart=always' in quad_restart_content.stdout" |
| 1552 |
- "'--restart' not in quad_restart_content.stdout" |
| 1553 |
fail_msg: "restart_policy should be in [Service] section, not as --restart in PodmanArgs" |
| 1554 |
|
| 1555 |
- name: Test different restart policies |
| 1556 |
containers.podman.podman_container: |
| 1557 |
executable: "{{ test_executable | default('podman') }}" |
| 1558 |
name: "container-restart-{{ item.name }}" |
| 1559 |
image: alpine |
| 1560 |
state: quadlet |
| 1561 |
quadlet_dir: /tmp |
| 1562 |
restart_policy: "{{ item.policy }}" |
| 1563 |
loop: |
| 1564 |
- { name: "on-failure", policy: "on-failure" } |
| 1565 |
- { name: "unless-stopped", policy: "unless-stopped" } |
| 1566 |
register: quad_restart_policies |
| 1567 |
|
| 1568 |
- name: Verify all restart policies are correctly mapped |
| 1569 |
shell: cat /tmp/container-restart-{{ item.item.name }}.container |
| 1570 |
loop: "{{ quad_restart_policies.results }}" |
| 1571 |
register: quad_restart_files |
| 1572 |
|
| 1573 |
- name: Check restart policy mapping |
| 1574 |
assert: |
| 1575 |
that: |
| 1576 |
- "'[Service]' in item.stdout" |
| 1577 |
- "'Restart=' in item.stdout" |
| 1578 |
- "'--restart' not in item.stdout" |
| 1579 |
loop: "{{ quad_restart_files.results }}" |
| 1580 |
|
| 1581 |
# Test for issue #913: Verify no duplicate [Service] section when user provides custom one |
| 1582 |
- name: Create Quadlet with restart_policy and custom Service section in quadlet_options |
| 1583 |
containers.podman.podman_container: |
| 1584 |
executable: "{{ test_executable | default('podman') }}" |
| 1585 |
name: container-restart-custom-service |
| 1586 |
image: alpine |
| 1587 |
state: quadlet |
| 1588 |
quadlet_dir: /tmp |
| 1589 |
restart_policy: always |
| 1590 |
command: sleep infinity |
| 1591 |
quadlet_options: |
| 1592 |
- | |
| 1593 |
[Service] |
| 1594 |
TimeoutStopSec=70 |
| 1595 |
Restart=on-failure |
| 1596 |
register: quad_custom_service |
| 1597 |
|
| 1598 |
- name: Read Quadlet file with custom Service section |
| 1599 |
shell: cat /tmp/container-restart-custom-service.container |
| 1600 |
register: quad_custom_service_content |
| 1601 |
|
| 1602 |
- name: Count [Service] sections in Quadlet file |
| 1603 |
shell: grep -c "^\[Service\]" /tmp/container-restart-custom-service.container |
| 1604 |
register: service_section_count |
| 1605 |
failed_when: false |
| 1606 |
|
| 1607 |
- name: Verify only one [Service] section exists (user's custom one takes precedence) |
| 1608 |
assert: |
| 1609 |
that: |
| 1610 |
- quad_custom_service is changed |
| 1611 |
- service_section_count.stdout == "1" |
| 1612 |
- "'TimeoutStopSec=70' in quad_custom_service_content.stdout" |
| 1613 |
- "'Restart=on-failure' in quad_custom_service_content.stdout" |
| 1614 |
- "'--restart' not in quad_custom_service_content.stdout" |
| 1615 |
fail_msg: "Should have exactly one [Service] section when user provides custom one" |
| 1616 |
|
| 1617 |
# Test for issue #1017: quadlet_options should not be moved into [Service] section |
| 1618 |
- name: Create Quadlet with restart_policy and quadlet_options containing plain options |
| 1619 |
containers.podman.podman_container: |
| 1620 |
executable: "{{ test_executable | default('podman') }}" |
| 1621 |
name: container-quadlet-options-order |
| 1622 |
image: alpine |
| 1623 |
state: quadlet |
| 1624 |
quadlet_dir: /tmp |
| 1625 |
restart_policy: always |
| 1626 |
quadlet_options: |
| 1627 |
- AutoUpdate=registry |
| 1628 |
- | |
| 1629 |
[Install] |
| 1630 |
WantedBy=default.target |
| 1631 |
register: quad_options_order |
| 1632 |
|
| 1633 |
- name: Read Quadlet file for options order test |
| 1634 |
slurp: |
| 1635 |
src: /tmp/container-quadlet-options-order.container |
| 1636 |
register: quad_options_order_content |
| 1637 |
|
| 1638 |
- name: Verify quadlet_options are placed in correct sections |
| 1639 |
vars: |
| 1640 |
content: "{{ quad_options_order_content.content | b64decode }}" |
| 1641 |
assert: |
| 1642 |
that: |
| 1643 |
- quad_options_order is changed |
| 1644 |
- "'AutoUpdate=registry' in content" |
| 1645 |
- "'[Service]' in content" |
| 1646 |
- "'Restart=always' in content" |
| 1647 |
- "'[Install]' in content" |
| 1648 |
- "'WantedBy=default.target' in content" |
| 1649 |
- "content.index('AutoUpdate=registry') < content.index('[Service]')" |
| 1650 |
- "content.index('[Service]') < content.index('[Install]')" |
| 1651 |
fail_msg: "Plain quadlet_options like AutoUpdate should be in [Container] section, not after [Service]" |
| 1652 |
|
| 1653 |
- name: Create Quadlet without restart_policy but with quadlet_options |
| 1654 |
containers.podman.podman_container: |
| 1655 |
executable: "{{ test_executable | default('podman') }}" |
| 1656 |
name: container-quadlet-options-no-restart |
| 1657 |
image: alpine |
| 1658 |
state: quadlet |
| 1659 |
quadlet_dir: /tmp |
| 1660 |
quadlet_options: |
| 1661 |
- AutoUpdate=registry |
| 1662 |
- | |
| 1663 |
[Install] |
| 1664 |
WantedBy=default.target |
| 1665 |
register: quad_no_restart |
| 1666 |
|
| 1667 |
- name: Read Quadlet file without restart_policy |
| 1668 |
slurp: |
| 1669 |
src: /tmp/container-quadlet-options-no-restart.container |
| 1670 |
register: quad_no_restart_content |
| 1671 |
|
| 1672 |
- name: Verify quadlet_options work correctly without restart_policy |
| 1673 |
vars: |
| 1674 |
content: "{{ quad_no_restart_content.content | b64decode }}" |
| 1675 |
assert: |
| 1676 |
that: |
| 1677 |
- quad_no_restart is changed |
| 1678 |
- "'AutoUpdate=registry' in content" |
| 1679 |
- "'[Service]' not in content" |
| 1680 |
- "'[Install]' in content" |
| 1681 |
fail_msg: "quadlet_options without restart_policy should not create a [Service] section" |
| 1682 |
|
| 1683 |
- name: Cleanup restart and quadlet_options test files |
| 1684 |
file: |
| 1685 |
path: "{{ item }}" |
| 1686 |
state: absent |
| 1687 |
loop: |
| 1688 |
- /tmp/container-restart-test.container |
| 1689 |
- /tmp/container-restart-on-failure.container |
| 1690 |
- /tmp/container-restart-unless-stopped.container |
| 1691 |
- /tmp/container-restart-custom-service.container |
| 1692 |
- /tmp/container-quadlet-options-order.container |
| 1693 |
- /tmp/container-quadlet-options-no-restart.container |
| 1694 |
|
| 1695 |
always: |
| 1696 |
|
| 1697 |
- name: Remove container |
| 1698 |
containers.podman.podman_container: |
| 1699 |
executable: "{{ test_executable | default('podman') }}" |
| 1700 |
name: testidem-pod |
| 1701 |
state: absent |
| 1702 |
|
| 1703 |
- name: Delete all container leftovers from tests |
| 1704 |
containers.podman.podman_container: |
| 1705 |
executable: "{{ test_executable | default('podman') }}" |
| 1706 |
name: "{{ item }}" |
| 1707 |
state: absent |
| 1708 |
loop: |
| 1709 |
- "alpine:3.7" |
| 1710 |
- "container" |
| 1711 |
- "container1" |
| 1712 |
- "container2" |
| 1713 |
- "container3" |
| 1714 |
- "testidem-pod" |
| 1715 |
- "container_tls" |
| 1716 |
- "container2_tls" |
| 1717 |
|
| 1718 |
- name: Remove pod |
| 1719 |
containers.podman.podman_pod: |
| 1720 |
executable: "{{ test_executable | default('podman') }}" |
| 1721 |
name: testidempod |
| 1722 |
state: absent |
| 1723 |
|
| 1724 |
- name: Remove podman images |
| 1725 |
containers.podman.podman_image: |
| 1726 |
name: "{{ item }}" |
| 1727 |
state: absent |
| 1728 |
loop: |
| 1729 |
- alpine:3.7 |
| 1730 |
- alpine |
| 1731 |
- alpine:3.20 |
| 1732 |
- alpine:3.12 |
| 1733 |
|
| 1734 |
- name: Remove temporary rootfs directory |
| 1735 |
ansible.builtin.file: |
| 1736 |
path: "{{ container_tempdir.path }}" |
| 1737 |
state: absent |
| 1738 |
when: container_tempdir is defined |
| 1739 |
ignore_errors: true |