Commit Graph

283 Commits

Author SHA1 Message Date
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