Commit Graph

237 Commits

Author SHA1 Message Date
Felix Fontein
b3b543dd8d
requests drops support for older Python. (#380) 2022-06-11 18:14:18 +00: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
9c7415e0e7
certifi dropped Python 2 support. (#356) 2022-05-19 07:17:28 +02:00
Felix Fontein
3a7c5551d7
Avoid extra '/' in CI names to avoid breakin coverage. (#349)
ci_coverage
2022-05-14 12:07:08 +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
Brian Coca
6679eee41e
docker connection: handle version and docker_args (#327)
* handle version and docker_args

* Remove breaking change.

* Add changelog fragment.

* Fix unit tests.

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-04-25 20:35:33 +02:00
Felix Fontein
e12a487e6a
Add EE support, support GHA in current_container_facts (#336)
* Try adding EE support.

* Use GHA instead of AZP for EE tests.

* Update changelog fragment, extend tests.

* Disable current_container_facts test.

* Increase verbosity.

* 2.9 compatibility.

* Use docker instead of podman for building EE and running tests in it.

* Output some more information (helpful for debugging).

* Fix GHA handling for current_container_facts.

* Try to fix permissions.
2022-04-18 22:54:00 +02:00
Felix Fontein
ca2e46131f
Switch from antsibull to antsibull-docs. (#334) 2022-04-10 10:44:16 +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
6f0e1149fd
Replace antsibull-lint collection-docs with antsibull-docs lint-collection-docs. (#322) 2022-03-30 07:55:50 +02:00
Felix Fontein
f3bfaa2458
Add stable-2.13 to CI, thin out older version matrix. (#320)
* Add stable-2.13 to CI, thin out older version matrix.

* Thin out a bit more.
2022-03-29 06:25:40 +02:00
Brian Coca
37a3264042
docker connection plugin: fix config docs and update to use config system (#297)
* fix config docs and update to use config system

 wean off play_context which did not have the correct data in all cases

* moar fixes

* Update plugins/connection/docker.py

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

* updated for backwards compat

* badmergeresolution

* makeitworks

* attempt to fix unit test

* mocking it# No more than 50 chars. #### 50 chars is here: #

* Update plugins/connection/docker.py

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

* Update plugins/connection/docker.py

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

* Update plugins/connection/docker.py

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

* Update plugins/connection/docker.py

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

* Update plugins/connection/docker.py

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

* Update plugins/connection/docker.py

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

* nomock

* remove bad paste

* properly load connection to initialize config

* initizlie docker args

* Fix bugs.

* Call _set_conn_data() when needed.

* Cache result of _get_docker_remote_user() now that it is called multiple times per task.

* Fix unit tests.

* list.clear() is Python 3...

* Add changelog.

* Call _set_conn_data() also in _connect().

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-03-21 19:19:14 +01: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
f94ba4cef3
Restrict PyNaCL to 1.4.x on RHEL8 when using Python 3.6 (#275)
* Restrict PyNaCL to 1.4.x on RHEL8 when using Python 3.6.

* Fix typo.
2022-01-08 14:53:21 +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
abd057f447
Fix collection dependency installation in CI. (#239) 2021-11-18 21:14:54 +01:00
Felix Fontein
3961ad3763
Replace Bash codecov uploader by new Python codecov uploader. (#235)
ci_coverage
2021-11-13 11:47:33 +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
9800da148a
Fix shellcheck error. (#220) 2021-10-08 14:14:05 +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
Felix Fontein
4ca348ea28 Prepare ansible-core devel branch version bump that is planned for later today. 2021-09-24 18:45:54 +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
Felix Fontein
5a3ce51049
Improve CI (#198)
* Use remote temp path, replace remote lookups.

* Copy local files.

* Change docker resource name prefix from ansible-test to ansible-docker-test to avoid collision with ansible-test's containers.

* Fix typos.

* We don't neceessarily have a TTY.

* Use hopefully less collision-likely subnet.

* More collision avoidance.

* More changes.
2021-09-08 09:43:35 +02:00
Ajpantuso
4dfc3ae5d7
docker_compose - Fix idempotency when services have no enabled profiles (#192)
* Initial Commit

* Adding integration tests

* Fixing integration and adding changelog fragment
2021-08-20 13:33:35 +02:00
Felix Fontein
6f52747693
docker_container: fix handling of command and entrypoint in a backwards-compatible way (#186)
* Fix handling of command and entrypoint in a backwards-compatible way.

* Fix copy'n'paste error.

* Fix some more.

* Improve documentation.

* Keep command and entrypoint as lists and not as strings.

* Simplify code, since we're already emitting the deprecation warning in this case during parameter processing.

* Change default only in community.docker 3.0.0.

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

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

* Apply suggestion to more places.

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
2021-08-02 19:31:46 +02:00
Jeff Goldschrafe
2a9bc7f74e
Add nsenter connection plugin (#173)
* Add nsenter connection plugin

* Fixes

* oops

* Pass file I/O through nsenter, removing volume mount

* minor logging cleanup for consistency's sake

* Fix pylint flag

* Update plugins/connection/nsenter.py

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

* Update plugins/connection/nsenter.py

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

* Update plugins/connection/nsenter.py

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

* Update plugins/connection/nsenter.py

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

* Update plugins/connection/nsenter.py

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

* Fix note formatting

* Revert string_types change

* Update tests/integration/targets/connection_nsenter/aliases

* Update tests/integration/targets/connection_nsenter/runme.sh

* Apply suggestions from code review

* Update tests/integration/targets/connection_nsenter/runme.sh

* Update tests/integration/targets/connection_nsenter/runme.sh

* Apply suggestions from code review

* Update tests/integration/targets/connection_nsenter/runme.sh

* Update tests/integration/targets/connection_nsenter/aliases

* Update plugins/connection/nsenter.py

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

* Update plugins/connection/nsenter.py

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

* Update plugins/connection/nsenter.py

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

* Update plugins/connection/nsenter.py

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

* Remove specific pipelining support

* Update plugins/connection/nsenter.py

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-08-02 08:17:53 +02:00
Ajpantuso
b2430f756f
Allowing anonymous volumes via mounts option (#181)
* Initial Commit

* Adding changelog fragment
2021-07-27 17:35:40 +00:00
Felix Fontein
e2785de840
Make sure that 'container' is returned in more circumstances, and improve documentation when it is actually returned (#178)
* Make sure that 'container' is returned in more circumstances, and improve documentation when it is actually returned.

* Fix typos.
2021-07-24 21:01:14 +02:00
Ajpantuso
9b661a6ac2
docker_compose - add env_file option (#174)
* Initial commit

* Adding changelog and fixing docs

* Fixing integration tests

* Restricting minimum docker-compose versions for tests

* Applying initial review suggestions
2021-07-16 19:01:20 +02:00
Lauri Tirkkonen
a0f2091e6a
put example addresses in actual RFC1918 range (#170)
172.1/16, 172.3/16 and 172.4/16 are not in the 172.16/12 range.

https://datatracker.ietf.org/doc/html/rfc1918#section-3
2021-07-01 19:06:18 +02:00
Ajpantuso
072d96ca62
docker_compose - Adding profiles option. (#167)
* Initial commit

* fixing tests

* Adding changelog fragment
2021-06-28 20:54:54 +02:00
Felix Fontein
1cdf8d5620
Forgot one change in #164. (#166) 2021-06-27 21:21:01 +02:00
Ajpantuso
49cb513244
docker_container - adding publish_all_ports option (#162)
* Initial commit

* Adding changelog fragment

* Updating deprecation notice

* Adding integration test

* Applying second round of review suggestions

* Updating docs and cleaning up integration tests

* Updating test loop logic
2021-06-27 16:51:30 +02:00
Felix Fontein
2d5875a397 Revert "Remove superfluous file."
This reverts commit d3d8f33ec5.
2021-06-26 14:27:58 +02:00
Felix Fontein
d3d8f33ec5 Remove superfluous file. 2021-06-26 13:51:08 +02:00
Ajpantuso
825a4f74d3
docker_plugin - adding alias option and general cleanup (#161)
* Initial Commit

* Adding changelog fragment
2021-06-25 21:45:53 +02:00
Ajpantuso
49c8fd0aa5
docker_host_info - Allow filters which are passed as lists (#160)
* Initial Commit

* Adding integration tests

* Adding example in docs

* Adding changelog fragment

* Applying initial review suggestions
2021-06-22 22:27:38 +02:00
Felix Fontein
af2b3b0493
docker_compose: fix idempotency for stopped services (#159)
* Always use |= instead of = when updating changed status.

* Fix idempotence bug.

* Add changelog fragment.
2021-06-22 12:07:50 +02:00
Felix Fontein
22bc8da783
Make extra sanity test runner produce ansibullbot and JUnit output. (#154) 2021-06-14 07:24:01 +02:00
Felix Fontein
fc241019b5
CI: Remove scripts that are no longer needed (#153)
* Remove scripts that are no longer needed.

ci_complete

* Remove sanity ignores.
2021-06-13 22:11:57 +02:00
Felix Fontein
eba726b42e
Add more docker_compose tests (#151)
* Add basic changed test.

* Add start/stop tests.
2021-06-07 07:24:41 +02:00
Felix Fontein
b775bac593
docker_image: allow to tag images by name, improve docs (#149)
* Add test to tag image with ID.

* Document that source=local also works with image IDs.

* Improve 'repository' documentation.

* Fix typo.

* Looks like a fix is needed to make this work.

* ...

* Avoid unnecessary re.search() calls.

* Add changelog fragment.

* Improve main description.

* Remove import.
2021-06-07 07:01:10 +02:00
Felix Fontein
4d0637e178
Add basic docker_compose tests (#150)
* Add basic docker_compose tests.

* Add more constraints for Py 2.

* Try to install docker-compose from system packages.

* Another try.

* Some more tries.

* One more.

* Move task into block.

* Clean up constraints file.

* More adjustments.

* TEMP: add debug output
2021-06-07 06:42:31 +02:00
Felix Fontein
9b73be4f30
Add extra docs tests (#146)
* Add extra docs tests.

* Linting.

* Fix copy'n'paste error.
2021-05-27 22:58:52 +02:00
Felix Fontein
b3284ce382
Restrict websocket-client to < 1.0.0 for Python 2. (#144) 2021-05-19 12:09:24 +02:00
Shane St Savage
a512e7fb9e
feat: allow unlimited memory_swap in docker_container (#138)
* feat: allow unlimited memory_swap in docker_container

summary: in docker_container, allow `memory_swap: values
`unlimited` and `-1` for unlimited container swap usage.

`--memory-swap=-1` is a valid docker run value allowing
unlimited swap usage. `docker_container` should allow
setting this value via `memory_swap` values `unlimited`
and `-1` as it sometimes must explicitly be set to prevent
docker from attempting to limit swap usage to double the
`--memory` value by default. In rootless docker environments,
attempting to set `memory-swap` usage limits will result in an error
if the user doesn't have the ability to do so. Allowing explicit
unlimited swap usage via docker_container will prevent these errors.

https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details

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

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-05-10 20:24:04 +02:00
Felix Fontein
74475d1d9b
docker_swarm_service: fix crash during idempotence check if published_port is not specified (#136)
* Avoid crash during idempotence check if published_port is not specified.

* Add tests.

* Convert lambda to function.
2021-05-05 08:00:22 +02:00
Felix Fontein
887472e60d
Replace busybox image with another one to hopefully avoid removal problems. (#133) 2021-05-02 15:38:22 +02:00
Felix Fontein
799dcb9fd6
Add ansible-test config file. (#132) 2021-05-01 22:37:18 +02:00
Felix Fontein
d63566dbd1
Use Ansible's codecov uploader. (#130) 2021-04-30 04:28:28 +02:00
Felix Fontein
ff503d9bd7
Add docker_container_exec module (#105)
* Move some code from plugin_utils to module_utils.

* First version of docker_container_exec module.

* Linting.

* Avoid using display.

* Move common socket_handler code to module_utils.

* Add module support, use it in docker_container_exec.

* Add tests.

* Fix copyright lines.

* Add this and other 'new' modules to README.

* Apply suggestions from code review

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/docker_container_exec.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2021-04-06 23:53:17 +02:00
Felix Fontein
6722435e65
Fix CI for docker-py 5.0.0 (#120)
* ci_complete

* Let's see whether constraints help to avoid installing 5.0.0 with Python < 3.6.
2021-04-06 23:10:03 +02:00
Felix Fontein
30c00c4c26
ansible/ansible's stable-2.11 branch has been created. (#117) 2021-04-06 05:09:38 +00:00
Felix Fontein
e9b10ee0a4
Add use_ssh_client flag (#114)
* Add use_ssh_client option.

* Unrelated cleanup (unneeded imports).

* Add SSH connection tests.
2021-04-02 10:14:09 +02:00
Felix Fontein
bc096a9ec9
Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. (#113) 2021-03-27 09:58:35 +01:00
Felix Fontein
89f6691753
Make sure we are logged out. (#112) 2021-03-26 21:37:54 +01:00
Felix Fontein
f338f3a5eb
Fix docker_swarm_service tests. (#104) 2021-03-14 22:52:05 +01:00
Felix Fontein
f142f8c86d
Add docker_image_load module (#90)
* Add docker_image_load module.

* Polish module.

* Fix bug and add tests.

* Apply suggestions from code review

Co-authored-by: Amin Vakil <info@aminvakil.com>

* Make sure that containers that still exist are also cleared.

* Always return stdout.

* Try to work around removal problems.

* Accept that the Docker daemon sometimes only reports the named image.

* More debug output.

* Also prune containers, in the hope that these cause the problems.

* Let's see whether pruning containers (but not images) is enough.

* Apply suggestions from code review

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/modules/docker_image_load.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Amin Vakil <info@aminvakil.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2021-03-05 09:06:21 +01:00
Sakar
da62cfc24a
New module docker_plugin (#95)
* New module docker-plugin with integration_tests

* Fix sanity test

* Changes made as per the reviewer suggested

* Fix check-mode and test directory

* Fix Sanity

* fix integration

* fix integration

* fix integration

* fix integration
2021-03-01 13:02:53 +01:00
Felix Fontein
f2d16da643
docker_image: improve/fix handling of image IDs (#87)
* Improve/fix handling of image IDs in docker_image.

* Fix syntax error.

* Linting.

* Fix name collision.

* Add various tests.

* Fix tests.

* Improve image finding by ID, and fix various related bugs.

* accept_not_there -> accept_missing_image.

* Remove unnecessary dummy variable.
2021-02-28 10:40:11 +01:00
Felix Fontein
ed9bf1117f
docker_image: allow to specify pull platform (#89)
* Allow to specify pull platform.

* Add basic test and document that the value is not used for idempotency at the moment.

* Fix pulling.

* Simplify code.

* Add API version for pull_platform.

* Move pull_platform into new pull option. Use apply_defaults=True to avoid some special logic.

* Add example.

* Remove apply_defaults=True.
2021-02-24 23:45:34 +01:00
Felix Fontein
f107ab281f
Add storage_opts option. (#93) 2021-02-24 23:01:34 +01:00
Piotr Wojciechowski
3ddd75ac68
Replicas max per node (#92)
* Adding 'replicas_max_per_node' placement parameter

* Adding 'replicas_max_per_node' placement parameter

* Adding 'replicas_max_per_node' integration tests

* Adding 'replicas_max_per_node' feature

* 'replicas_max_per_node' documentation update

* 'replicas_max_per_node' unit test fix

* Documentation and changelog updates

* Update changelogs/fragments/92-replicas-max-per-node.yml

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

Co-authored-by: WojciechowskiPiotr <devel@it-playground.pl>
Co-authored-by: Felix Fontein <felix@fontein.de>
2021-02-24 10:14:06 +01:00
Felix Fontein
f5d68755c4
Fix healthcheck idempotency issue with strict comparison. (#88) 2021-02-17 22:56:52 +01:00
Felix Fontein
5456006169
Fix CI (#82)
* Limit cryptography to < 3.4 for Python < 3.6.

* Work around old pip versions.
2021-02-09 06:47:26 +01:00
Felix Fontein
dffbca3847
Use ipaddress vendored in community.crypto. (#78) 2021-01-30 16:00:16 +01:00
Felix Fontein
8702713ac3
docker_image: do not crash in load_image for docker-py < 2.5.0. (#73)
* Avoid crash for docker-py < 2.5.0.

* Add warnings when load_image does not return a generator.

* Add test.

* Update plugins/modules/docker_image.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2021-01-25 15:17:04 +01:00
Felix Fontein
c1e6c2e699
Fix IPv6 zone handling (#66)
* Support IPv6 zones (RFC 4007).

* Add changelog fragment.

* Remove change for docker_network.

* Add IPv6 zone test.

It looks like an arbitrary zone name works. If Docker daemon ever starts
validating it (against what?) we either have to try to fix this test by
a valid value, or remove it again.
2021-01-25 15:16:35 +01:00
Felix Fontein
6adb148675
Add default_host_ip option. (#71) 2021-01-20 23:53:23 +01:00
Felix Fontein
c7a3d9f057
docker_container: cgroup_parent (#59)
* Document that the Docker SDK for Python is used by the module.

* Allow to specify cgroup_parent for container.
2021-01-03 13:30:09 +01:00
Felix Fontein
e4b747d788
docker_container: return status also when 0 for non-detached containers (#58)
* Return status also when 0.

* Fix PR number.
2021-01-02 18:53:25 +01:00
Felix Fontein
9b131399ce
Docker inventory plugin (#61)
* Began with docker inventory plugin.

* Linting.

* Improve plugin, add basic unit tests.

* Linting.

* Add integration test.

* Adjust tests to case that there are more containers.

* There can be stopped containers.

ci_coverage

* docker -> docker_containers
2020-12-30 08:44:24 +01:00
Felix Fontein
5eef093e99
Check output of load_image and react upon. (#55) 2020-12-27 15:04:38 +01:00
Felix Fontein
117f132213
docker_image: always push, also when tagging is not necessary (#53)
* Always push, also when tagging is not necessary.

* Add tests.

* Fix tests.
2020-12-26 18:20:28 +01:00
Felix Fontein
d40c2409d3
docker_image: allow to specify build platform (#54)
* Allow to specify build platform.

* Add basic tests.
2020-12-25 19:01:37 +01:00
Felix Fontein
5fa53e2eeb
Improve tests: don't install daemon when running inside a container (#56)
* If running inside a container, only install docker CLI, not docker daemon.

ci_complete

* Fix OpenSUSE.
2020-12-23 13:36:40 +01:00
Felix Fontein
8bd33b06c4
docker_api connection plugin (#40)
* Add basic docker_api connection test.

* Split AnsibleDockerClient into module-independent and module-specific part.

* Mention new connection plugin.

* Fix tests.

* Add first version of docker_api connection plugin.

* Linting.

* Fix references.

* Improve connection tests.

* Fix put_file for all Python versions.

* Fix fetch_file.

* Linting.

* Update plugins/connection/docker_api.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Move potential common code to module_utils / plugin_utils.

* Move socket_handler to plugin_utils.

* Fix typo.

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2020-12-15 20:07:55 +00:00
Felix Fontein
ebafa17b02
[WIP] Fix CI (#50)
* Centralize location of images for runme.sh tests.

* Switch images.

* Fix sanity.

* Fix image names.

* Fix tag chaos.

* One more.
2020-12-15 13:57:38 +01:00
Felix Fontein
fe2d52ff29
Fix AZP tests, add current_container_facts module (#48)
* Add new facts module for determining whether the module is running inside a container or not.

* Add containers to main network.

* Fix running tests locally with newer docker.

* Simplify setup_openssl to only install cryptography.

* Add alias in network.

* Make sure to upgrade cryptography to something more sensible on Ubuntu 16.04.

* Don't jump through hoops for bridge.

* Try to use other IPv4 nets.

* Improve module docs.
2020-12-13 08:06:16 +00:00
Felix Fontein
2bf46c2eb2
Fix docker_image test. (#47)
ci_complete
2020-12-11 21:12:48 +01:00
John R Barker
3955955b37
Remove PATH hack (#44)
* Remove PATH hack

azure-pipelines-test-container:1.7.1 contains a proper fix for ensuring
PATH contains the location of pip installed binaries so we can remove
the hack.

* Correct RHEL groups
2020-12-11 13:54:14 +00:00
John Barker
7e63c3ae4d Initial Azure Pipelines 2020-12-10 18:08:22 +00:00
Felix Fontein
65ab240e2b
Try to make connection test work with coverage (#39)
* Try to make connection test work with coverage.

ci_coverage

* Don't run test inside containers.

ci_coverage

* Empty commit to run without coverage.
2020-11-24 17:29:02 +01:00
Felix Fontein
219c6b3a85
Improve and fix tests (#36)
* Parameterize test images.

* Use different images, similar to ansible/ansible#72698.
2020-11-23 21:48:46 +01:00
Felix Fontein
1fa2c3b77d
By default, no longer do cleanup of setup_docker. (#38)
Cleanup means purging the docker daemon. This was necessary when the
docker tests were run as part of ansible/ansible and community.general
CI, but in the community.docker CI the problematic runs are on their
own CI node.

ci_complete
2020-11-22 22:18:48 +01:00
Felix Fontein
c0bd1becea
Add docker connection tests (#37)
* Add docker connection tests.

* Make it easier to switch image.
2020-11-22 22:03:16 +01:00
Felix Fontein
bc0e0c3049
Adjust version_added, re-place tests. (#34) 2020-11-15 17:21:50 +01:00
Raghu Siddarth Udiyar
ea8c107625 Add docker build output to task result (#805)
The build output is only added during failures, but its useful to
have this available during normal task execution as well.
2020-11-15 16:57:05 +01:00
Felix Fontein
18ef0bae0b
Added file I forgot to add to community.general. (#33) 2020-11-14 18:14:23 +01:00
Felix Fontein
e691ad72ab
Remove ignore.txt entries (#29)
* Remove some ignore.txt entries.

* Prepare for validate-plugins.
2020-11-06 06:18:41 +01:00
Felix Fontein
5dba331bc7 Adjust deprecations (#1)
* First batch of c.g 2.0.0 deprecations.

* Remove use_tls and force from docker_image.

* More removals.

* Change community.general 3.0.0 deprecations to community.docker 2.0.0.

* Fix sanity.

* Fixing some bugs.

* Add PR URL to fragment.

ci_complete
ci_coverage

* Improve docs, remove superfluous code.
2020-10-30 07:05:51 +01:00
Felix Fontein
f4210b31dc Run unit tests for all Python versions in one CI node. (#2) 2020-10-30 07:05:51 +01:00
Felix Fontein
6555a5a0de Initial cleanup. 2020-10-30 07:05:51 +01:00
Felix Fontein
a8835f5bf5 docker_container: add device_requests option (#1119)
* docker_container: add device_requests option.

* Fix copy'n'paste mistake.

* Fix failure test.

* Added example.

* Adjust tense.
2020-10-30 07:05:51 +01:00
Felix Fontein
914374b279 Improve docker test setups (#1161)
* Improve readability.

* Move common code to new file.
2020-10-30 07:05:51 +01:00
Felix Fontein
25e898068a docker_login: fix internal config file storage to handle credentials for more than one registry (#1118)
* docker_login: fix internal config file storage to handle credentials for more than one registry

* Improve setup for docker registry.

* Add second registry frontend. Add tests for #1118.

* Fix cleanup.
2020-10-30 07:05:51 +01:00
Felix Fontein
765f31a673 Run tests with macOS 10.15. (#971)
* Run tests with macOS 10.15.

* Restrict to macOS CI runs for now until they pass.

* Skip tests on macOS that are skipped on OSX.

* Disable consul test for macOS.

* Disable chroot connection tests for macOS.

* Add setup_gnutar role from https://github.com/ansible/ansible/pull/71841.

* Use setup_gnutar for yarn and npm tests.

* Revert "Restrict to macOS CI runs for now until they pass."

This reverts commit d945d0399f1727a5fe5942089c74d6662bd2b045.

* hashi_vault lookup tests seem to be always unstable, disabling for now.

* Use homebrew module instead of command.
2020-10-30 07:05:51 +01:00
Felix Fontein
773a2a5316 docker_container: fix idempotency problem with empty published_ports list (#979)
* Distinguish between [] and None.

* Add changelog fragment.

* Fix typo.
2020-10-30 07:05:51 +01:00
Andrew Klychkov
9b8c8a8701 Add headers to ci tests (#954)
* CI tests: add note to main.yml

* improve
2020-10-30 07:05:51 +01:00
Felix Fontein
dd91461a1f Fix docker test setup. (#957) 2020-10-30 07:05:51 +01:00
Felix Fontein
bd906faa4e Fix CI (problem with cffi) (#892)
* Work around old pip versions which install yanked packages.

* Try II

* Proper approach.

* Avoid too old version being installed.
2020-10-30 07:05:51 +01:00
Felix Fontein
f6181de5cb docker_stack_task_info tests: add delay to make sure task is running (#765) 2020-10-30 07:05:51 +01:00
Felix Fontein
2416b910c5 Try to fix docker tests (#764)
* Try to limit docker package version if API version is < 1.39.

* Fix error.

* Re-combine to one command.
2020-10-30 07:05:51 +01:00
Sam Doran
41ceece19f Remove "rhui-" prefix from RHEL repository (#762) 2020-10-30 07:05:51 +01:00
Jose Angel Munoz
449d4c91c8 New Docker Stack Task Info Module with Tests (#732)
* Add docker_stack_task_info with tests

* Change link

* Change ln

* Fix Documentation

* Small doc changes

* Remove node for RH
2020-10-30 07:05:51 +01:00
Jose Angel Munoz
2a04082533 New docker_stack_module with tests (#576)
* First docker stack info approach without tests

Fixes results when no stack availabl

Fixes sanity test

Fixing links

Fixes tabs

Fixes long line

Improving Json Output

Changes arguments

Lint with autopep8

Moves imports

Adds extra line

Adds Tests

Adds pip and fixes return empty

Fixes silly missing else

* Adds Tests and Fixes comments

* Removes tasks option

* Removes arguments

* Changes error message

* Changes Tests

* Add proposals f

* Improve output

* Change test for output change

* Add debug
2020-10-30 07:05:51 +01:00
Minh Ha
19f35bae91 removes advertise_addr from required parameters when state is "join" (#646)
* removes advertise_addr from required parameters when state is "join"

addressing this issue: https://github.com/ansible-collections/community.general/issues/439

* adjusts test

* adds changelog
2020-10-30 07:05:51 +01:00
Felix Fontein
3c00bc53a7 Fix docker_container tests (#549)
* Stop using ansible.netcommon.next_nth_usable.

It requires netaddr to be installed before running the playbook, which isn't the case in CI.
This undoes cf61474c3b.

* Use own filter to avoid needing netaddr installed.
2020-10-30 07:05:51 +01:00
Felix Fontein
87230c1c2f Clean up deprecations (#504)
* Adjust deprecation versions.

* Remove redirects that are already made in ansible/ansible's ansible_builtin_runtime.yml

* Remove modules that were moved to the google.cloud collection according to ansible/ansible's ansible_builtin_runtime.yml.

* The _info module is in google.cloud.

* The gcp doc_fragment is a copy of the one in google.cloud and is only used by one lookup. Mark as deprecated/internal.

* Remove entries of modules that no longer exist.

* Update ignore.txt.

* Try to fix test.

* Remove debug output.
2020-10-30 07:05:51 +01:00
Petr Klejch
0bb0a748b9 Add 'init' option for docker_swarm_service. (#476)
* Add 'init' option for docker_swarm_service.

* Add changelog fragment.

* CR fixes.
2020-10-30 07:05:51 +01:00
Sam Doran
8ff83e7276 inventory_docker_swarm test - Remove exit code from trap (#391)
Setting the exit code in a trap overrides the exit code that caused the
trap to be called. This means if the test failed and called the trap,
the test will exit with 0 rather than the failure exit code.
2020-10-30 07:05:51 +01:00
Felix Fontein
a40da6bd3b Don't die when docker CLI doesn't want to work with docker daemon (#366)
* Don't die when docker CLI doesn't want to work with docker daemon.

* Allow more 'docker volume ls' failures

* More.

* Fix more failures.

* Forgot ignore_errors.

* Another one.

* More places.

* Try to install newer docker on RHEL8.

* Also restrict docker-ce-cli.
2020-10-30 07:05:51 +01:00
Felix Fontein
837b1adfe7 Add Fedora 32 to CI; drop Fedora 30 which is soon EOL (#327)
* Add Fedora 32 to CI; drop Fedora 30 which is soon EOL.

* Docker only supports Fedora up to 31; fortunately the 31 package seems to work for 32 too.

* Also skip for Fedora 32, as it apparently has a similar problem to Fedora 31.

ci_complete
2020-10-30 07:05:51 +01:00
Felix Fontein
bfcb96573f Update testing (#147)
* Remove superfluous requirements file.

* Update RHEL 7.6 to RHEL 7.8 in CI.

* Fix docker install.

* ci_complete
2020-10-30 07:05:51 +01:00
Felix Fontein
910f3adff2 Move modules and module_utils unit tests to correct place (#81)
* Move modules and module_utils unit tests to correct place.

* Update ignore.txt

* Fix imports.

* Fix typos.

* Fix more typos.
2020-10-30 07:05:51 +01:00
Felix Fontein
fe2eded15a Fix more tests (#66)
* Fix permissions.

* Fix more FQCNs.

* Adjust more ansible_pkg_mgr usages.

* Fix plugin FQCN.

* Change port 12345 -> 12347.

* Print port usage first.

* Support both short and long name.

* Revert "Print port usage first."

This reverts commit ea1dbc60f08a2664a8b01abba7aa7610bc2a23f1.

* Revert "Change port 12345 -> 12347."

This reverts commit cbc13510ee9f855110b4134517b2a548745a1fb0.

* Fix cleanup.

* Add more FQCNs.

* Allow short name as well.

ci_complete

* Add remaining ignore.txt entries for ipaddress.

* Remove kubevirt ignore.txt entries.

* Added missing entries, and sorted.

* Remove superfluous fact gathering.

* Fix FQCNs.

* Temporarily disable supervisorctl (fails on OSX because socket path is too long)

* Add missing file.

* Fix permissions.

ci_complete
2020-10-30 07:05:51 +01:00
Felix Fontein
0560501336 Fix FQCRs. (#64) 2020-10-30 07:05:50 +01:00
Felix Fontein
0abe7ddc8b Fix imports, part 2 (#42)
* Recover missing netapp.ontap module doc fragments from ansible/ansible@pre-ansible-base.

* Fix PEP8 issues.

* Remove netbox empty files, and test which shouldn't be here.

* Add forgotten file for kubevirt tests.

* Fix unit test imports.

* ansible/ansible#68415 has been fixed.

* Clean up/rearrange imports.

* Update ignore.txt, fix boilerplate.

* Netapp docs fragment: fix spacing

* Forgot to adjust kubevirt tests.
2020-10-30 07:05:50 +01:00
Ansible Core Team
a1f472244d Initial commit 2020-10-30 07:05:50 +01:00