Commit Graph

128 Commits

Author SHA1 Message Date
Felix Fontein
58036e5092
mac_address no longer works with Docker API v1.44+. (#764) (#768)
(cherry picked from commit 648e0652d5)
2024-01-20 14:27:04 +01:00
Felix Fontein
e501ed2c59
Adjust to new shellcheck in ansible-core devel's sanity tests. (#741) (#742)
(cherry picked from commit 5256f94342)
2024-01-04 22:43:38 +01:00
Felix Fontein
5e96be6c39
Compose digest instead of accidentally using wrong one. (#733) (#734)
(cherry picked from commit 42453444ff)
2023-12-31 15:43:12 +01:00
Felix Fontein
1e286852b2
[stable-2] Integration tests: split up Docker setup, move docker_compose tests into own group (#719)
* Rename setup role.

* Create new CI group 6, and move docker_compose v1 tests into there.

* Split up Docker setup in integration tests.

* Change setup_docker_compose_v1 to install its own Docker SDK for Python.

* Restrict Docker SDK for Python to < 7.0.0 in EE.
2023-12-09 18:38:54 +01:00
Felix Fontein
4e172e3111
Fix bad expressions in tests. (#711) (#712)
ci_complete

(cherry picked from commit b8afdc52b1)
2023-11-28 23:11:24 +01:00
patchback[bot]
dd9aeac0bd
Force PyYAML to 5.3.1. (#669) (#670)
(cherry picked from commit 017536953a)

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-07-19 16:50:45 +02:00
Felix Fontein
84fc4ca30b
SuSE: install docker-compose v1 from pip instead of system packages. (#650) (#651)
The system package switched to docker-compose v2.

(cherry picked from commit 3f9f41e5a9)
2023-06-20 08:26:54 +02:00
Felix Fontein
c68d90de76
Switch to Ansible Galaxy compatible requirements files for tests. (#633) (#634)
(cherry picked from commit 74b70f81c8)
2023-05-21 14:55:16 +02:00
patchback[bot]
88fb666d41
More true/false normalization. (#597) (#598)
(cherry picked from commit d0a3e587a5)

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-03-06 22:36:33 +01:00
Felix Fontein
94227e2575
docker_prune: correctly return 'changed' result (#593) (#594)
* Correctly return 'changed' status.

* Extend tests.

* Fix typo.

(cherry picked from commit 08bfcf7e5f)
2023-02-24 21:24:39 +01:00
Felix Fontein
ec4c17efef
CI: Make tests work with Docker API version 1.42 (#576) (#577)
* Make tests work with API version 1.42.

* Make sure anonymous volume is separated from container a bit earlier.

* Another try.

(cherry picked from commit 3a1bfc4be2)
2023-02-04 22:31:15 +01:00
Felix Fontein
e418fe59d8
Looks like BuilderSize was never documented and eventually got removed. Replace with something that is documented (https://docs.docker.com/engine/api/v1.42/#tag/System/operation/SystemDataUsage). (#569) (#571)
(cherry picked from commit d57b26269a)
2023-02-03 12:48:26 +01:00
patchback[bot]
41b1337d8e
[PR #563/c0d9ca67 backport][stable-2] Fix CI (#565)
* Restrict to old enough paramiko on RHEL 8 or other systems using Python 3.6. (#563)

(cherry picked from commit c0d9ca67c4)

* Make sure paramiko is installed on localhost as well.

* Revert "Make sure paramiko is installed on localhost as well."

This reverts commit f36406c2db.

* Fix check.

* ...

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-01-22 19:06:56 +01:00
Felix Fontein
5ffba04ef0 Don't uninstall docker. 2023-01-14 11:16:57 +01:00
Felix Fontein
e7aa5dcdec CI: improve Docker setup (#550)
* Cache has already been updated a few lines before.

* When skipping Docker cleanup, create flag to avoid the expensive part of the setup (including package manager cache update) to be run again.

(cherry picked from commit 134d32cae6)
2023-01-13 21:05:54 +01:00
Felix Fontein
0ffa3cc1d2
docker_plugin: do not crash when plugin doesn't exist (#553) (#556)
* Do not crash when plugin doesn't exist.

* Improve style.

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
(cherry picked from commit c7cbec0163)
2023-01-13 21:00:34 +01:00
patchback[bot]
098a77fe4c
Handle ansible_default_ipv4 not there in tests. (#514) (#515)
(cherry picked from commit 6e04e1f172)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-12-01 00:11:38 +01:00
Felix Fontein
3da9aa3b9c
[stable-2] Make current_container_facts work with newer Docker versions and latest ansible-test container changes (#512)
* Make current_container_facts work with newer Docker versions and latest ansible-test container changes (#510)

* Add more debug output.

* Add basic integration test.

* Split into lines.

* Fix docker detection, add podman detection.

ci_complete

* Improve regular expression.

* Document that this module is trying its best, but might not be perfect.

* Update comment.

(cherry picked from commit c2d84efccb)

* Remove new feature (podman support).
2022-11-30 23:01:30 +01:00
Felix Fontein
94e0acf523
Add tests for build.args. (#457) 2022-08-16 13:47:12 +02:00
Felix Fontein
bd62f82ca5
Fix docker_container tty test. (#444) 2022-08-11 22:08:34 +02:00
patchback[bot]
4d0f00db3c
Adjust to b1dd2af4ca. (#423) (#425)
(cherry picked from commit c00b4ec9be)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-12 17:12:48 +02:00
patchback[bot]
ff242fab8e
Fix tests on Ubuntu 22.04 (#419) (#420)
* Try to fix tests on Ubuntu 22.04.

* Let Ansible handle the apt repo install.

(cherry picked from commit f6d4cad46e)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-07-08 07:23:15 +02:00
Felix Fontein
57e19ca596 Revert "Remove deprecations from docker_container, bump collection version to 3.0.0 (#399)"
This reverts commit 49ce0a3cb1.
2022-07-02 14:18:48 +02:00
Felix Fontein
49ce0a3cb1
Remove deprecations from docker_container, bump collection version to 3.0.0 (#399)
* Remove deprecated features in docker_container.

* Bump collection version to 3.0.0.

* Remove 'published_ports: all' tests.
2022-07-01 19:16:22 +02:00
Felix Fontein
2080c63f05
Try to fix tests. (#374)
ci_complete
2022-05-24 12:49:22 +02:00
Rodrigo Candido Gryzinski
497c2fda91
Add image_label_mismatch parameter to docker_container (#370)
* Add image_label_mismatch to docker_container

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Test image_label_mismatch error message

* Add change fragment for image_label_mismatch

* Break long line in docker_container.py for pep-8 compliance

* pep8 compliance

* Update changelogs/fragments/370-add-image-label-mismatch.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix: add expected_labels to parameters_map in docker_container

* Apply suggestions from code review

* Apply suggestions from code review

* Update tests/integration/targets/docker_container/tasks/tests/options.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-24 08:35:33 +02:00
Felix Fontein
b32d40f714
Try pull with digest in tests. (#366) 2022-05-23 12:21:23 +02:00
Felix Fontein
401a76ff00
docker_container: fail if there are too many parts in a parsed port (#367)
* Fail if there are too many parts in a parsed port.

* Add tests.

* Prevent bad parsing.
2022-05-22 17:20:05 +02:00
Felix Fontein
ab2d33aa99
CI: Replace the container used in the nsenter tests (#368)
* Replace the container used in the nsenter tests.

* Improve connection tests.g

* Use quay.io/ansible/ansible-runner:devel instead.
2022-05-21 16:53:09 +02:00
Felix Fontein
cfc6fb9d40
Add RHEL 9.0, Ubuntu 22.04 and Fedora 36 to CI (#358)
* Add RHEL 9.0 to CI.

* Add RHEL 9 specific files.

* Add Ubuntu 22.04 and Fedora 36 to CI.

* Another try.

* Adjust kernel memory tests.

* Add more details.

* RHEL 9 doesn't support setting memory swappiness.

* Fix docker_swarm_service tests.

The 'less' case should always have been changed, but it probably was always skipped
due to a too old Docker SDK for Python or a too old Docker daemon.

* More checks / improve checks.
2022-05-20 16:27:13 +02:00
Felix Fontein
155a8b4ba9
Run some tests with the latest PyPi version of Docker SDK for Python (#348)
* Run some tests with the latest PyPi version of Docker SDK for Python.

* Use new enough Python so we can actually install the latest Docker SDK for Python.

* Ansibilize

* Fix test.

* Fix two stupid errors by myself.
2022-05-13 22:06:51 +02:00
Sasha Jenner
560bf1d3a3
docker_config integration tests for template_driver (#347)
* template_driver integration tests

* adding comment

* naming swarm default

* Apply suggestions from code review

* Only run tests for new enough Docker SDK for Python and Docker API version.

Co-authored-by: Sasha Jenner <sasha.jenner@cba.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-13 13:46:12 +02:00
Felix Fontein
b362bdfd88
Remove 'warn:' that's removed in ansible-core 2.14. (#328) 2022-04-01 22:46:58 +02:00
Felix Fontein
48391d6755
Extend docker_compose tests, add Alpine to CI (#304)
* Add test where project is started with project_src only (#303).

* Work around bug in docker_compose.

* Add Alpine in CI.
2022-03-14 09:34:08 +00:00
Felix Fontein
d49008f066
CI: Add ArchLinux, Debian Bullseye and CentOS Stream 8 (#301)
* Add ArchLinux, Debian Bullseye and CentOS Stream 8 to CI.

* Fixes.
2022-02-18 23:04:17 +01:00
Felix Fontein
078afc9769
Don't mask return value. (#299) 2022-02-14 20:50:36 +01:00
András Maróy
3ad49824db
Implement cap_add and cap_drop handling for docker_swarm_service (#294)
* Implement `cap_add` and `cap_drop` handling for `docker_swarm_service`

* Fix typos in changelog fragment

* Add missing `version_added` docstrings to `docker_swarm_service`

* Check api version too in `docker_swarm_service` capability tests

* Fix API version checking in tests for docker_swarm_service

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add `cap_add` and `cap_drop` to sample output for `docker_swarm_service`

* Use proper diff checking for `docker_swarm_service` capabilities

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-12 08:30:44 +01:00
András Maróy
1d062dad5c
Implement rolling_versions for docker_config (#295) 2022-02-12 08:30:09 +01:00
András Maróy
b481fa4801
Add support for rotating docker secrets (#293)
* Add parameters for rolling updates to `docker_secret`

* Extract `remove_secrets` to its own function in `docker_secret`

* Store existing secrets in a list instead of a single secret

With this change `docker_secret` now supports the case where we store
multiple versions of a secret with the `_v123` postfix.

`absent` state implicitly handles removing these this way.

* When using `rolling_versions` don't automatically remove current secret

To make rolling updates actually work instead of failing on trying to
remove a secret that is attached to a service, use the
`versions_to_keep` parameter to remove old versions of the secret after
creating the new one. This way the secret with the new data is created
with a different name and can be attached to the service by its ID
without having to delete the previous one first which would fail if it
is already attached to a service.

* Add version numbers to newly created secrets

Attach the incremental version number to the secret name as a `_v123`
postfix where `123` is replaced with an incremental counter starting
from 1.
A label with the numeric version is also attached to the secret to ease
calculating the new version number upon change with the name
`ansible_version`.

* Return `secret_name` for docker secrets as well

* Add integration test for rolling secrets

* Update `docker_secret` documentation as per review comments

* Correctly return `docker_secret` version number as int

* Use template string for naming `docker_secrets` instead of concatenation

* Return the correct secret name on deletion failure

* Simplify `docker_secret` creation

* Add missing comma for `docker_secret` schema

* Only remove old docker secrets if `rolling_versions` is set

* Add check in `docker_secret` version parsing to handle NaNs

* Add newly created `docker_secret` to internal secret list to avoid additional deletions

* Add changelog fragment for `docker_secret` `rolling_versions` feature

* Update changelogs/fragments/270-rolling-secrets.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-12 08:29:49 +01:00
Felix Fontein
946f1a7322
Try to fix CentOS 8 in CI - at least a bit. (#287) 2022-01-31 20:56:31 +01:00
Felix Fontein
40576e317b
docker_container_exec: allow to specify environment (#254)
* Allow to specify environment parameters for docker_container_exec.

* Add changelog fragment.

* sorted -> list.
2021-12-22 16:56:22 +00:00
Felix Fontein
02596835b1
Add detach parameter. (#255) 2021-12-22 17:37:08 +01:00
Felix Fontein
3c53e763a1
Explicitly install iptables. (#227) 2021-11-03 21:50:10 +01:00
Felix Fontein
ec82806a59
Fix wrong FQCNs. (#225) 2021-10-17 16:04:48 +02:00
Felix Fontein
f4b1d34357
Fix CI (docker_container tests fail because of missing ipaddress) (#218)
* Use stdlib ipaddress, resp. install when needed.

* Make sure facts on controller are available.
2021-10-07 13:15:51 +02:00
Felix Fontein
4070dab9a8
Remove deprecated features, bump version to 2.0.0 (#210)
* Remove docker_login's email option.

* container_default_behavior now has default value no_defaults.

* Disallow 'all' next to other ports. Deprecate 'all' in favor of publish_all_ports.

* Change default for network_mode.

* Add changelog fragment.

* Fix tests.

* Next expected release is 2.0.0.
2021-10-05 17:39:42 +02:00
Ajpantuso
b5263ccbd0
Initial commit (#208) 2021-09-17 17:00:14 -04:00
Felix Fontein
5d861004db
docker_config and docker_secret: add data_src option (#203)
* Add data_src options to docker_config and docker_secret.

* Add examples.

* Fix test.

* Another fix.
2021-09-12 09:42:03 +02:00
Felix Fontein
668f77d7d2
Make sure the nginx config and password files are readable by everyone. (#202) 2021-09-11 12:21:27 +02:00
Felix Fontein
40f61ae8c8
docker_network: improve test failure debugging (#201)
* Show inspection results for all Docker networks before running docker_network tests.

* AZP/Docker seems to prefer networks in 172.0.0.0/8, so we use 10.0.0.0/8 for our tests.

* Fix use of wrong variable.
2021-09-10 22:10:35 +02:00