Commit Graph

154 Commits

Author SHA1 Message Date
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]
4928828d22
Fix error handling. (#546) (#548)
(cherry picked from commit 18091193de)

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-01-05 21:15:21 +01:00
Felix Fontein
8811d9be10
Improve container detection. (#522) (#523)
(cherry picked from commit e87b327764)
2022-12-06 08:39:15 +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
patchback[bot]
bb7f89974a
Add docstring to ImageManager.__init__ and fix docstring for ImageManager.archive_image (#509) (#511)
(cherry picked from commit ee9ddb954f)

Co-authored-by: iamjpotts <8704475+iamjpotts@users.noreply.github.com>
2022-11-30 22:14:34 +01:00
patchback[bot]
6512400b44
Fix non-matching defaults. (#494) (#496)
(cherry picked from commit 1ac3a99e7c)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-11-01 19:20:32 +01:00
patchback[bot]
8db6513298
added documentation to indicate docker_swarm_service does not currently support operating on stack based services. (#491) (#493)
(cherry picked from commit df864221d6)

Co-authored-by: James A. Robinson <jim.robinson@gmail.com>
2022-10-26 13:13:25 +02:00
patchback[bot]
29050ffbb8
Improve docker_compose example (#470) (#474)
* Improve compose docs.

* Also adjust inline v1 example.

(cherry picked from commit 3b41e7d6a8)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-09-08 06:49:21 +02:00
patchback[bot]
f901eeb57e
Clarify that BuildKit / buildx cannot be used with docker_image. (#468) (#472)
(cherry picked from commit 9458bc6e62)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-09-08 06:38:24 +02:00
patchback[bot]
89deaf4189
Fix two more booleans. (#464) (#465)
(cherry picked from commit 1e24120014)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-24 06:53:31 +02:00
patchback[bot]
154e1902de
Fix error formatting bug. (#448) (#450)
(cherry picked from commit f513ba2c59)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-12 14:15:40 +02:00
Felix Fontein
b29e91f866
Normalize booleans in all other plugins and modules. (#440) (#443)
(cherry picked from commit be58ccc13f)
2022-08-10 21:46:13 +02:00
patchback[bot]
81273a93f2
Normalize booleans in docker_container docs. (#439) (#442)
(cherry picked from commit 1bf8da2390)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-10 18:16:50 +02:00
patchback[bot]
855227c892
Fix docs. (#436) (#437)
(cherry picked from commit bc6757d3b8)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-04 14:33:10 +02:00
Felix Fontein
e6d597b539 Revert "Remove deprecated functionality. (#363)"
This reverts commit 209aeb57fd.
2022-07-02 14:18:53 +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
209aeb57fd
Remove deprecated functionality. (#363) 2022-07-01 19:02:22 +02:00
Felix Fontein
f41d7ac1b8
Move common utility code to plugins.module_utils.util (#390)
* Move common utility code to plugins.module_utils.util.

* Also adjust plugins.

* Fix import.
2022-06-20 18:39:13 +02:00
Felix Fontein
a44e0736cf
Improve API version handling. (#389) 2022-06-20 07:34:38 +02:00
seffyB
6ff739390e
Update docker_container.py (#378)
##### Correct Typo in the word compatibility
Change all occurrences of `compatiblity` to be `compatibility` as it looks to be a typo.
For example, when running a task with `command_handling: compatiblity` an error will be thrown stating an invalid value


##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr
2022-06-01 07:38:51 +02:00
Garrit Franke
9c33aa5d12
Remove trailing space (#375)
* Remove trailing space

* Update plugins/modules/docker_compose.py

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-27 10:31:15 +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
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
7e710f743d
Bump deprecations we forgot to remove in 2.0.0. (#362) 2022-05-20 14:45:52 +02:00
Felix Fontein
fb55b1d780
Avoid breakage with Python 3.13. (#354) 2022-05-18 22:22:50 +02:00
Felix Fontein
6adc7bddf3
Add PSF-license.txt file. (#350) 2022-05-16 07:35:23 +02:00
Sasha Jenner
c63ef4116d
Support --template-driver for docker_config (#332) (#345)
* initial templating changes

* adding docs

* author

* responding to pr comments

* testing for idempotency

* using template_driver rather than templating

* adding explicit idem check

* remove local testing changes

* bug fix

* fixing idempotency

Co-authored-by: Sasha Jenner <sasha.jenner@cba.com.au>
2022-05-11 07:26:59 +02:00
chrische
98b227003e
docker_swarm: adds data_path_addr option for swarm init and swarm join (#344)
* adds data_path_addr option for swarm init and swarm join. (ansible-collections/community.docker#339)

* adds changelog fragment (ansible-collections/community.docker#339)

* adds formatting to changelog entry

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

* adds version to doc entry in ansible_swarm

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

* rewrites doc entry to formal language

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

* Correct docker api version (src: docker api docs)

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-09 20:37:27 +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
Shane St Savage
eaacf6c8f6
Support getting container output from local logging driver (#337)
The `local` [Docker logging driver](https://docs.docker.com/config/containers/logging/local/) is a new-ish, optimized local logging driver that improves upon json-file. Since logs written using `local` can still be accessed through the Docker daemon API, all that is needed here is to add to the supported list.
2022-04-24 21:39:59 +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
addisonshelley
69399d736d
Update docker module documentation for log_options (#317)
* Update docker module documentation for log_options

Add that log_driver must be specified for log_options to take effect

* Update plugins/modules/docker_container.py

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-03-27 15:30:23 +02:00
Felix Fontein
3c7c496e67
Implement connection reset. (#312) 2022-03-22 07:13:39 +01:00
Felix Fontein
b353a39ada
Adjust docker_api plugin to ansible-core 2.13. (#308) 2022-03-22 07:11:32 +01:00
Felix Fontein
421b712812
docker connection plugin: simplify actual_user handling code (#311)
* Simplify actual_user handling code.

* Forgot self.
2022-03-22 07:11:14 +01: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
ba5e6f89f3
Fix warning/error extraction. (#305) 2022-03-14 21:01:35 +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
9cd46a7d41
Try to make more compatible with podman-docker. (#292) 2022-02-11 12:23:36 +01:00
Felix Fontein
fbbc0898ed
More small docs fixes. (#281) 2022-01-10 07:42:40 +01:00
Felix Fontein
3d20ba1bc2
Improve documentation (#278)
* Improve documentation.

* More fixes.
2022-01-09 14:52:44 +01:00
Felix Fontein
d4b7ec0a9a
Fix comment. (#272) 2022-01-06 12:56:12 +00:00
Felix Fontein
264f5238c7
Fix unintended breaking change by vendoring distutils.version. (#269) 2022-01-05 20:08:59 +00:00
Richard James Acton
15ab747d86
Added cap_add to the documentation for capabilities for easier search (#265)
* added cap_add to the documentation for capabilities for easier search comming from docker

* added equivalent syntax for docker cli and compose to capabilities docs

* added equivalent syntax for docker cli and compose to capabilities docs
2022-01-05 13:09:22 +01:00
Felix Fontein
4b235a2607
Prepare for distutils.version being removed in Python 3.12 (#258)
* Prepare for distutils.version being removed in Python 2.12.

* Fix copy'n'paste error.

* Fix import.

* Re-add Loose prefix.

* Fix Python version typo.

* Improve formulation.

* Move message into own line.

* Fix casing, now that the object is no longer called Version.
2021-12-24 11:28:35 +01:00
Felix Fontein
93ea131f30
Get rid of distutils.spawn. (#257) 2021-12-24 11:27:23 +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