Commit Graph

573 Commits (301d561420cd80b749db4973ff9a057ea829c9f2)

Author SHA1 Message Date
Joni Salmi ff0f6286d7 Docker service update project_name doc (#36713)
```
FAILED! => {"changed": false, "msg": "Parameter error - project_name required when providing definition."}
```
2018-02-26 08:25:50 -05:00
Abhijeet Kasurde 4cc7af7372
docker_login: Hide password from response (#34491)
Fixes: #32869

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-02-16 10:41:54 +05:30
Michael Nugent d212ca11b3 False matches the docs and intentions of the previous developer (#35762) 2018-02-15 15:40:10 -05:00
John R Barker a23c95023b
Module deprecation: docs, scheme and tests (#34100)
Enforce module deprecation.
After module has reached the end of it's deprecation cycle we will replace it with a docs stub.

* Replace deprecated modules with docs-only sub
* Use of deprecated past deprecation cycle gives meaningful message (see examples below)
* Enforce documentation.deprecation dict via `schema.py`
* Update `ansible-doc` and web docs to display documentation.deprecation
* Document that structure in `dev_guide`
* Ensure that all modules starting with `_` have a `deprecation:` block
* Ensure `deprecation:` block is only used on modules that start with `_`
* `removed_in` A string which represents when this module needs **deleting**
* CHANGELOG.md and porting_guide_2.5.rst list removed modules as well as alternatives
* CHANGELOG.md links to porting guide index

To ensure that meaningful messages are given to the user if they try to use a module at the end of it's deprecation cycle we enforce the module to contain:
```python
if __name__ == '__main__':
    removed_module()
```
2018-01-30 12:23:52 +00:00
Michael 75130b4a4d Support domainname in docker_containers (#32292) 2018-01-23 08:24:37 -06:00
Yury Tsarev 7c8120d0de Fix misleading cleanup/detach documentation (#34674)
* Fix misleading cleanup/detach documentation

Current documentation is not concrete regarding desired
state of `detach` to make container be properly removed
with `cleanup`

Make `detach:false` be mentioned explicitly

* Tweak formatting
2018-01-10 15:33:22 +00:00
John Barker c57a7f05e1 Bulk autopep8 (modules)
As agreed in 2017-12-07 Core meeting bulk fix pep8 issues

Generated using:
autopep8 1.3.3 (pycodestyle: 2.3.1)
autopep8 -r  --max-line-length 160 --in-place --ignore E305,E402,E722,E741 lib/ansible/modules

Manually fix issues that autopep8 has introduced
2017-12-07 20:25:55 +00:00
Nicolas DOUILLET 4b4c1fdb13 Fix memory_reservation typo in docker_container module (#33375) 2017-11-29 19:01:49 -05:00
Harris Dimitriou 9e9f2b9ad5 Added userns support on docker_container module Fixes #20648 (#22195)
* added userns support on docker_container module

* Fixes #20648 - changed 'version_added' of userns_mode to 2.3 from 2.2

* version_added 2.5
2017-11-28 16:54:19 +00:00
Dag Wieers 9d156c6cb1
docker: PEP8 compliancy and documentation changes (#32628)
This PR includes:
- PEP8 compliancy changes
- Documentation changes
2017-11-07 15:35:50 +01:00
UnderwayNYC 11faafcbf7 Fix error when there are no docker volumes present yet (#28145)
* Fix error when there are no docker volumes present yet

* fixes suggested by Shippable
2017-10-30 15:53:08 -04:00
Kenny Gillen 1234a79349 Fix gender pronouns and the odd typo (#31709) 2017-10-13 13:52:38 -04:00
Toshio Kuratomi 75eed6a51a Port arg specs from type='str' to type='path' 2017-10-09 21:15:56 -07:00
François Scala aade5234a9 Fix urlparse import for Python3 (#31240)
* Fix urlparse import for Python3 in

* contrib/inventory/consul_io.py
* contrib/inventory/rudder.py
* contrib/inventory/windows_azure.py
* lib/ansible/module_utils/known_hosts.py
* lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py
* lib/ansible/modules/cloud/docker/_docker.py
* lib/ansible/modules/cloud/ovirt/ovirt_disk.py
* lib/ansible/plugins/action/ce_template.py
2017-10-09 20:18:09 -07:00
John R Barker e859d0da9c data should be redacted in docker_secret (#31366) 2017-10-05 14:07:23 -04:00
Andrew Lihonosov 4c0889e8fc docker_service build command respects the "pull: no" parameter
Fixes #30296.
2017-10-02 11:11:48 -04:00
Artem Bolshakov fb4d065654 Fix running docker container with not readable logging driver. Fixes #27278 2017-10-02 11:00:16 -04:00
Sebastien Boyron cb5f2c7ac3 [fix] issue #29886 - it misses oom_killer in host_config_params (#30712)
so it was never passed to docker API.
2017-09-25 20:42:02 -04:00
Sebastien Boyron 901bc2cffe Clean code, fd.close not required since open as fd if used; remove get_redirected_output from cleanup_redirection_tempfiles since output is not used
(cherry picked from commit ef51f00bbc9f24485915040b863c9d034d3c272c)
2017-09-21 20:01:13 -07:00
Toshio Kuratomi f66c74915c Fix docker_service python3 incompatibility
Looks like this is supposed to operate on native strings so there's no
need to encode or decode at all here

Fixes #30354
2017-09-21 19:50:54 -07:00
Abdul Anshad A 272c0ce68c fixes #5732 - Add support for using network ID (#22503) 2017-08-30 17:32:45 -04:00
Stephen Jennings be2d4cc1c9 Check for an existing docker_network before trying to modify it (#24048)
This eliminates a TypeError in check mode.
2017-08-23 12:10:53 -04:00
Jun Guo 655667527d [docker] Fix ignore_image option not work issue. (#19039)
Currently the ignore_image option can be set, but can not work as it is
descripted in document. The reason is the code will check the difference
of configurations between current container and target image, and it
will mark the `different` to `True` when the image is different even we
set `ignore_image=true`, that will cause the container being re-create.
2017-08-17 13:47:52 -04:00
Alvaro Aleman f8e79eb481 Fix changed event for docker_image in force mode 2017-08-17 10:42:09 -04:00
Toshio Kuratomi f203ca7907 Update metadata to 1.1 2017-08-15 23:12:08 -07:00
Abhijeet Kasurde e419a55c71 Add correct URL for docker guide (#27465)
Fixes : #27463

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-30 10:08:43 +01:00
Toshio Kuratomi 1ee08c0f06 Get rid of more wildcard imports and add boilerplate to more modules
This commit cleans up the following module categories:
* messaging
* inventory
* crypto
* commands
* clustering
* cloud/webfaction
* cloud/docker
* cloud/digital_ocean
2017-07-29 07:02:12 -07:00
Toshio Kuratomi 225fa5d092 Fix undefined variables, basestring usage, and some associated python3 issues 2017-07-25 15:58:23 -07:00
Toshio Kuratomi df15583ad0 Promulgate house's fix for docker_volume to docker_secret
* Revert change to docker_common as it's not as good as the try: except fix
* limit docker_volume fix to ImportErrors
* fix docker_secret i nthe same way
* Remove docker_secret from import tests
2017-07-19 13:20:47 -07:00
Chris Houseknecht 2e073e73d2 Fixes doc string in docker_volume (#27074) 2017-07-19 15:42:31 -04:00
Alex Grönholm 657ab58139 Added the docker_volume module (#24957)
* Added the docker_volume module

* Code style fixes

* Added yours truly to the copyright statement

* Added documentation link

* Fixed YAML syntax in documentation string

* Documentation style fixes based on the code review

* Implemented requested code corrections

* Added documentation for the "labels" option
* Handled APIErrors from docker-py
* Fixed the type of the "labels" option (dict -> list)

* Fixed typo

* Import APIError from docker_common, not from docker-py
2017-07-19 13:43:54 -04:00
Will Medlar 3f67d167fe [Fixes #26690] Supports Python 3 handling of base64 encoding (#26876)
* [Fixes #26690] Supports Python 3 handling of base64 encoding

* Set text auth to separate variable for reuse
2017-07-17 21:11:52 -07:00
Chris Houseknecht 6af53cf0ef Adds docker_secret module (#26469) 2017-07-06 09:22:04 -04:00
Chris Houseknecht 8765eadb30 Fixes list comparison (#26042) 2017-06-26 11:06:57 -04:00
Will Rouesnel 42b608db0c Add support for tmpfs to docker_container. (#25747) 2017-06-23 08:03:28 -04:00
Matthew Schick 846174b4ba Update nocache to be the proper bool type instead of string (#24358)
* Update nocache to be the proper bool type instead of string

* Add proper bool type for params
2017-06-19 11:24:19 +01:00
Chris Houseknecht 20bddde669 docker_service: Forward stderr-based output from docker-compose (#25456)
PR #5165 at https://github.com/ansible/ansible-modules-core/pull/5165
adds redirection and capture of stdout during execution of
docker-compose.

This doesn't necessarily catch all errors, since some are printed to
stderr and lost.

This extends the redirection to include stderr, and does minor string
processing to attempt to find a 'useful' message to present as the
final Ansible error.
2017-06-07 23:30:26 -04:00
Kassian Sun 42d57782c0 Try to fix travis 2017-06-02 10:10:34 -07:00
Kassian Sun 981249daa1 use single line for-loop 2017-06-02 10:10:34 -07:00
Kassian Sun b3a37da671 Add --sysctl support for cloud/docker_container 2017-06-02 10:10:34 -07:00
louis 7363776174 fixes #19550 (docker_container with empty links list always restarts) 2017-05-24 16:14:10 -07:00
kkjang 5c43bd3bae Cmp python3 compat (#25008)
* Use double-quotes for expect integration tests

* Cast user input to string for expect integration tests

* Remove usage of cmp() for python3 compatibility

- Add code smell test to look for cmp usage

- Fixes #24756
2017-05-24 15:59:59 -07:00
Konrad Klimaszewski 64f63a3cac Properly handle Docker image comparison for published_ports defined as IP::PORT
- Published port defined as IP::PORT where parsed in expected.parameters
  as 0.0.0.0::PORT leading to changed==True on every playbook run.
2017-05-24 15:55:30 -07:00
bengerman 5b39368108 use two-tuples rather than dicts to allow multiple aliases for the same target 2017-05-24 15:48:12 -07:00
Nikolay Murga 3610a2457f Fixed #21464 - docker_network: TypeError with existing network (#24266)
Fixed #22530 - docker_network Failed but Overlay network created successfully on Docker swarm mode
2017-05-24 14:21:24 -07:00
bengerman cb3026f769 rebuild docker containers if there are less ports exposed 2017-05-24 12:37:29 -07:00
bengerman fab2dfd1c6 typo in security opts 2017-05-24 12:16:31 -07:00
Michael Sheinberg 272125023f Add working_dir to docker_container (#20044) (#24977)
* docker_container: add working_dir (fixes #20044)

Added a working directory option that will get passed with the other
docker container parameters. This is optional and addresses feature
request #20044.
2017-05-24 11:41:54 -07:00
Andrew Shewmaker f5fd32eae6 docker_container: do not split command on commas (#24900)
* docker_container: do not split command on commas

Fix issue #24430

* docker_container: document command parameter

Prior behavior was strange, splitting strings on commas
only to join them again ... replacing commas with spaces.

FYI, docker-py accepts strings or lists, using shlex.split
on strings ... splitting on spaces while respecting things
like quotes.

https://github.com/docker/docker-py/blob/master/docker/api/container.py
https://github.com/docker/docker-py/blob/master/docker/types/containers.py
https://github.com/docker/docker-py/blob/master/docker/utils/utils.py

More info regarding Dockerfile syntax for CMD strings and lists
can be found at https://docs.docker.com/engine/reference/builder/#cmd
2017-05-22 15:39:57 -07:00
Matt Martz 3324d0a4b0 Support auto_remove in docker_container (#22929)
* Support auto_remove in docker_container

* Fail if not docker>=2 and auto_remove=True, don't set auto_remove in host_config if not docker>=2

* Make quoting more readable in ansible errors
2017-05-09 16:19:27 -04:00
Alex Willmer 1ac17213ea Rename fact returned by docker_network to avoid restricted prefix (#23919)
This fixes #23918
2017-04-28 08:45:53 -05:00
Andrea Tartaglia 1d0a629dcc Fixed docs for cloud modules (#23745)
* Fixed docs for cloud modules

* removed blank line in ec2_snapshot_facts
2017-04-27 12:01:11 +01:00
smaftoul 9812d211e7 typo: psuedo -> pseudo (#23177) 2017-03-31 10:48:29 -04:00
Chris Houseknecht 4099eb41b9 Treats both [] and {} as equal to None (#23088) 2017-03-29 22:48:21 +02:00
Ilya Simonenko dba8edf735 cloud: docker: Fixes #22638 load image to memory when archive_path provided (#22642) 2017-03-16 10:06:19 -07:00
Dylan Silva 9ffad27319 Changed supported_by from curated to community (#22654) 2017-03-15 14:28:33 -07:00
John R Barker 9857ce8ddb Fix render issue (#22650) 2017-03-15 16:31:37 +00:00
Toshio Kuratomi eb1214baad New metadata 1.0 (#22587)
Changes to the metadata format were approved here:
https://github.com/ansible/proposals/issues/54
* Update documentation to the new metadata format
* Changes to metadata-tool to account for new metadata
  * Add GPL license header
  * Add upgrade subcommand to upgrade metadata version
  * Change default metadata to the new format
  * Fix exclusion of non-modules from the metadata report
* Fix ansible-doc for new module metadata
* Exclude metadata version from ansible-doc output
* Fix website docs generation for the new metadata
* Update metadata schema in valiate-modules test
* Update the metadata in all modules to the new version
2017-03-14 09:07:22 -07:00
Chris Houseknecht b15ceee6bd Changes command and entrypoint to type list 2017-03-13 14:39:23 -04:00
John R Barker e5b990a55a Fix invalid fields in module DOCUMENATION (#22297)
* fix module doc fields

* More module docs corrections

* More module docs corrections

* More module docs corrections

* More module docs corrections

* correct aliases

* Review comments

* Must quote ':'

* More authors

* Use suboptions:

* restore type: bool

* type should be in the same place

* More tidyups

* authors

* Use suboptions

* revert

* remove duplicate author

* More issues post rebase
2017-03-09 16:20:25 +00:00
Brian Coca 20bf02f6b9 rename return var to avoid conflicts
fixes #22323
2017-03-07 12:08:31 -05:00
Andrea Giardini 04e990281e Add flag to Docker pull_image to know when the image is already latest (#21508)
* Add flag to Docker pull_image to know when the image is already latest

Whenever the flag pull is set to 'yes' the resource is always defined
as 'changed'. That is not true in case the image is already at the
latest version.

Related to ansible/ansible#19549

* Docker pull_image does not change status if the image is latest
2017-03-03 10:16:16 -05:00
Matt Martz 305c88700d PEP8 E712 fixes (#21916) 2017-02-24 16:49:43 -06:00
Ryan Brown d64d38a1f4 [cloud][docker] Insensitive search for docker port publishing (#21579) 2017-02-17 10:41:26 -05:00
Zhuo Peng fe02dbecc0 [cloud] Fix a minor doc error in docker_container module (#21033) 2017-02-17 10:01:15 -05:00
Tomas Tomecek 30026cfb84 [cloud] module docker_image: print output on failure (#20757)
Fixes https://github.com/ansible/ansible-modules-core/issues/5161

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2017-02-16 09:47:18 -05:00
Matt Martz 7c00346714 Validate EXAMPLES as YAML 2017-02-15 13:01:43 -08:00
Matt Clay cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 2017-01-30 15:01:47 -08:00
Matt Clay 10d9318de7 PEP 8 indent cleanup. (#20800)
* PEP 8 E121 cleanup.

* PEP 8 E126 cleanup.

* PEP 8 E122 cleanup.
2017-01-29 07:28:53 +00:00
Matt Clay d0d1158c5e PEP 8 cleanup. (#20789)
* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
2017-01-28 00:12:11 -08:00
Matt Clay d913f69ba1 PEP 8 W291 whitespace cleanup. 2017-01-27 17:08:02 -08:00
Matt Clay 95789f3949 PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup.
* PEP 8 W293 whitespace cleanup.
* Fix whitespace issue from recent PR.
2017-01-27 15:45:23 -08:00
Ryan S. Brown 619e97d67e docker_container: remove third digit from version_added docs 2017-01-25 12:04:10 -05:00
Ryan S. Brown 7a19a18e61 [docs] Update docker_container docs to match syslog-tag deprecation in docker 1.13
Closes #20591
2017-01-25 10:19:10 -05:00
Jun Guo cfed617dba Support option none in docker_container when setting log_driver (#19040)
Per official docker document, it support setting `--log-driver=none` to
disable any logging for the container. So let's add it to this module.

Fixes #5337
2017-01-23 20:23:58 +00:00
dariko e2a1ce2916 [docker] Add compatibility with docker-py v2.0 2017-01-18 14:39:18 -05:00
Tyrone Tudehope 38d42e8b36 module is a property of the global object client (#19744)
Fixes #5466
2017-01-05 08:59:30 -08:00
Jun Guo 31526595c5 docker_image: docs: won't be pushed to private registry without push parameter. (#19691) 2016-12-27 08:15:12 +01:00
Andrea Tartaglia ef391a11ec Removed dict.iteritems() in modules. (#18859)
This is for py3 compatibility, addressed in #18506
2016-12-12 15:16:23 -08:00
James Cammarata 8afa090417 Resolving differences in core modules post-merge 2016-12-08 11:25:36 -05:00
Toshio Kuratomi 7319104552 Refreshed metadata for core modules 2016-12-08 11:25:35 -05:00
Asara dddf810a19 Fixed typo in docker_image.py docs (#5764) 2016-12-08 11:25:34 -05:00
Luc Charpentier be7af0193d error in docker_container example (#5631) 2016-12-08 11:25:31 -05:00
Abdul Anshad A 480c364afd fixes issue #5517 (#5519) 2016-12-08 11:25:31 -05:00
Sam Doran 38c0769abb Examples syntax batch5 (#5622)
* Change example syntax on supervisorctl module

* Change example syntax or _ec2_ami_search module

* Change example syntax on cloudformation module

* Change example syntax on ec2 module

* Change example syntax on ec2_facts module

* Change example syntax on ec2_eip module

* Change example syntax on rds module

* Change example syntax on route53 module

* Change example syntax on s3 module

* Change example syntax on digital_ocean module

* Change example syntax on docker_service module

* Change example syntax on cloudformation module

* Change example syntax on gc_storage module

* Change example syntax on gce module

* Change example syntax on gce_mig module

* Change example syntax on _glance_image module

* Change example syntax on _keystone_user module

* Change example syntax on _nova_keypair module

* Change example syntax on _quantum_floating module

* Change example syntax on _quantum_floating_ip_associate module

* Change example syntax on _quantum_network module

* Change example syntax on _quantum_router module

* Change example syntax on _quantum_router_gateway module

* Change example syntax on _quantum_router_interface module

* Change example syntax on _quantum_subnet module

* SQUASH _quantum_subnet

* Add missing quotes
2016-12-08 11:25:31 -05:00
Patrick F. Marques dc4cff7350 Remove duplicated option from examples 2016-12-08 11:25:28 -05:00
jctanner 06e1141106 replace type() with isinstance() (#5541)
Replace all use of type() with isintance()

Addresses https://github.com/ansible/ansible/issues/18310
2016-12-08 11:25:27 -05:00
Brian Coca ba6bc5382d corrected version added 2016-12-08 11:25:25 -05:00
Brian Coca 20f2fe4e91 added logout to docker_login
also cleaned up 'actions' and minor doc issues
2016-12-08 11:25:25 -05:00
Daniel Andrei Minca ca36d232d5 fix unclear documentation for docker container
the docker container module's `exposed_ports` was slightly ambigous.

Use the official Docker documentation to define what an `exposed port`
is.

Resolves: ansible/ansible-modules-core#5303
Signed-off-by: Daniel Andrei Minca <mandrei17@gmail.com>
2016-12-08 11:25:22 -05:00
John R Barker 25b6492d37 Bulk spelling improvement to modules-core (#5225)
* Correct spelling mistakes

* Correct more spelling issues

* merge conflict

* Revert typo in parms
2016-12-08 11:25:20 -05:00
John Barker bca8bbe7c2 Correct functional typos 2016-12-08 11:25:19 -05:00
Chris Houseknecht 8e9befa5ba Surface Compose stdout on failure
Signed-off-by: Chris Houseknecht <chouseknecht@ansible.com>
2016-12-08 11:25:18 -05:00
Chris Houseknecht 63b6672ea5 Improved enumeration of actions 2016-12-08 11:25:18 -05:00
Chris Houseknecht 1e4b8c13a3 Improved build and pull error handling 2016-12-08 11:25:18 -05:00
Chris Houseknecht 0e4b470ee2 Let docker-py handle decoding and JSON parsing of stream data. Fixes #4930. 2016-12-08 11:25:14 -05:00
Chris Houseknecht 9432adfaf7 Put requested devices in correct format to enable config comparison. Fixes #5000. 2016-12-08 11:25:14 -05:00
Aditya Marella c3f815a6f6 Docker module: add support for OomScoreAdj
* docker-py param name oom_score_adj
* translates to OomScoreAdj in the docker remote API
* setting version_added to "2.2"
2016-12-08 11:25:13 -05:00
shaung bcbeed244b Fix #4504 Respect timeout option when starting/stopping/restarting containers. 2016-12-08 11:25:13 -05:00
Chris Houseknecht f33828e753 Cast scale value to int. Fixes #4592. 2016-12-08 11:25:11 -05:00
Chris Houseknecht b01af0d747 Make project start and stop error handling more resilient, and improve message text. 2016-12-08 11:25:11 -05:00
Chris Houseknecht e95f773d96 Set default log_driver to None to prevent config comparison when a log_driver is not specified. Fixes #4600. 2016-12-08 11:25:03 -05:00
Chris Houseknecht 05303a974d Purge networks using network name rather than ID. Fixes 4596. 2016-12-08 11:25:03 -05:00
Chris Houseknecht 890c2d04e2 Default restart_retries to None rather than 0. Fixes #4534. 2016-12-08 11:25:03 -05:00
chouseknecht 964b7ecffa Fix container labels expected vs actual comparison. 2016-12-08 11:24:54 -05:00
chouseknecht 1b4a3dbc86 Fix doc strings. Use of > was breaking HTML generation on docs site module page. 2016-12-08 11:24:52 -05:00
Linus Arver 8da17b750d docker_service: fix files/project_files typo
The original decision to rename from `project_files' to `files' was in
3a5dd0007634c9d4e379f20cac77c8fd64b67f42.
2016-12-08 11:24:51 -05:00
chouseknecht fb99277066 Exposing tcp and udp for same port fails. Fixes issue #4354. 2016-12-08 11:24:51 -05:00
PikachuEXE fc87dd9650 Allow specifying human readable value for option `memory_limit` again (#4049) 2016-12-08 11:24:50 -05:00
chouseknecht 76260d3aa8 Fix network alias and network link comparison. - Using set based comparison was not working consistently - With != operator worked locally but consistently failed on Travis - With 'not in' operator failed locally and on Travis 2016-12-08 11:24:50 -05:00
chouseknecht 433b5e187f If debug true, include actions and differences in output. 2016-12-08 11:24:50 -05:00
Chris Houseknecht a8111adcd6 Some post merge clean up: (#4406)
- Removed required_if.
  - Fixed doc strings.
  - Removed debug output being appended to actions.
  - Put import of basics at bottom to be consistent with other docker modules
  - Added 'containers' alias to 'connected' param
  - Put facts in ansible_facts.ansible_docker_network
2016-12-08 11:24:50 -05:00
Brian Coca 94486c5c77 doc fix 2016-12-08 11:24:50 -05:00
Chris Houseknecht af3884f558 Adding docker_network module. (#4404) 2016-12-08 11:24:50 -05:00
muxator 16db1d54d1 typo in the documentation of the "state" parameter (#4353) 2016-12-08 11:24:48 -05:00
Chris Houseknecht 2514ec5056 Add buildargs parameter to support Dockerfile ARG directive. (#4349)
* Add buildargs parameter to support Dockerfile ARG directive.

* Fix doc_strings. Doc string for load_path was completely missing.
2016-12-08 11:24:48 -05:00
chouseknecht f6b126d412 Default repository tag value to tag parameter value or 'latest'. 2016-12-08 11:24:48 -05:00
chouseknecht 3dab1785ba Always returns changed when state present and name includes :tag. 2016-12-08 11:24:48 -05:00
Chris Houseknecht 1cf9d3e68e Add *build* to state parameter choices. Updated deprecation message. Will be deprecated in release 2.3. Removed (#4342)
mention of *tagged* state in the force parameter doc strings. There is no *tagged* state.
2016-12-08 11:24:48 -05:00
chouseknecht 2ea29fee3f Fix image tag operation. Allows repository in form of repo:tag. If no tag value, defaults to 'latest'. 2016-12-08 11:24:48 -05:00
chouseknecht 0c4da5d3a0 Added implementation of ignore_image, which prevents recreation of containers on image change. 2016-12-08 11:24:47 -05:00
chouseknecht 5992c21c9c Fix #3670 host IP defaults to 0.0.0.0 ignoriing bridge Host IP option. 2016-12-08 11:24:47 -05:00
chouseknecht a6bfeea1c4 Improved documentation for returned actions. 2016-12-08 11:24:47 -05:00
chouseknecht cd7b34547d When build true call docker-compose build, and add nocache option. 2016-12-08 11:24:47 -05:00
chouseknecht df09b4f668 Set version_added 2016-12-08 11:24:47 -05:00
chouseknecht 1670d9b030 Add pull option to pull images prior to evaluating service state. 2016-12-08 11:24:47 -05:00
Julien Vey 7ba3ba2da9 Fix Typo in docker_image_facts module 2016-12-08 11:24:46 -05:00
Chris Houseknecht c91de38322 Entrypoint fails with 'command not found' error. 2016-12-08 11:24:43 -05:00
Chris Houseknecht 7ffa6a43c5 Add push parameter. Let API handle registry authentication check. 2016-12-08 11:24:43 -05:00
Chris Houseknecht 4002caf60e Fix module failing when no ports are exposed 2016-12-08 11:24:43 -05:00
jjshoe d8b752b3cf Fixed a typo (#4168) 2016-12-08 11:24:43 -05:00
Chris Houseknecht 030dcccad4 Fix multi-interface port binding. 2016-12-08 11:24:43 -05:00
Chris Houseknecht bd3e1c77fe Add cleanup parameter. (#4144) 2016-12-08 11:24:43 -05:00
Chris Houseknecht 7515b2d563 Fix 'all' option for published_ports parameter. 2016-12-08 11:24:43 -05:00
Chris Houseknecht dc496ffeb4 Fix purge_networks 2016-12-08 11:24:43 -05:00
Qi Luo b86a229b61 Fix getting actual_stdin_open 2016-12-08 11:24:42 -05:00
Rodríguez, Jorge 82c26ad2d7 Do not forcibly push when building, either. 2016-12-08 11:24:39 -05:00
Rodríguez, Jorge 89e8787d65 Don't forcibly push loaded images to registry. Fixes #3763 2016-12-08 11:24:39 -05:00
chouseknecht 3d5f84c528 Fix compose_version error. Check has compose before checking version. 2016-12-08 11:24:38 -05:00
chouseknecht 1e9590ab65 Fix index 2016-12-08 11:24:38 -05:00
chouseknecht cc053c45ce Fix ulimit comparison 2016-12-08 11:24:38 -05:00
Hagen Kuehn 320aea77c6 fixed unknown type <type 'list'> error (#3959) 2016-12-08 11:24:37 -05:00
chouseknecht 16e7dc4e2e Remove dns from container create parameters. 2016-12-08 11:24:37 -05:00
chouseknecht 4d51a51ac3 Fix #3945 docker_container detach not waiting on container to execute. 2016-12-08 11:24:37 -05:00
chouseknecht 82436d5519 Fix #3941 2016-12-08 11:24:37 -05:00
Stefan Hajnoczi 7c4a469174 docker_service: make PyYAML requirement explicit
The "Developing Modules" documentation states:

  Include a minimum of dependencies if possible. If there are
  dependencies, document them at the top of the module file, and have
  the module raise JSON error messages when the import fails.

When docker_service runs on a remote host without PyYAML it crashes with
ImportError.

This patch raises a JSON error message when import fails, but only if
the PyYAML module is actually used.  It's only needed when the
"definition" parameter is given.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2016-12-08 11:24:37 -05:00
chouseknecht 617c230b62 Fix #16211 - only stop/kill running containers 2016-12-08 11:24:36 -05:00
Chris Houseknecht b5820c7398 Fix #3906 - Enforce required minimum compose version. (#3925)
* Fix #3906 - Require minimum compose version.

* Fix typo in message text.
2016-12-08 11:24:36 -05:00
Stefan Hajnoczi 38013de366 Stream image data in load_image() to avoid out-of-memory
Reading the entire tar file into memory can result in out-of-memory
conditions such as this traceback:

Traceback (most recent call last):
  File "/tmp/ansible_YELTSu/ansible_module_docker_image.py", line 486, in load_image
    self.client.load_image(image_data)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/image.py", line 147, in load_image
    res = self._post(self._url("/images/load"), data=data)
  ...
  File "/usr/lib/python2.7/httplib.py", line 997, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 848, in _send_output
    msg += message_body
MemoryError

Luckily docker-py's load_image(), which calls requests post(), accepts a
file-like object instead of a string.  Pass in the file object to avoid
reading the full file into memory.  This allows larger tar files to load
succesfully.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2016-12-08 11:24:36 -05:00
Vince v. Oosten 42a38f9141 move environment variable gathering to end of __init__() (#3890)
* This moves the lines in the code that parse the `env` and `env_file` options for docker to the end of the `__init__()` function.
This is needed because the `_check_capabilites` function needs both a working `self.client` and a proper `self.docker_py_versioninfo`.
`_check_capabilities` is used by `ensure_capabilities` which is, in turn, used by `get_environment`

This means that before this commit, the environment variables could not be loaded because both `self.client` and `self.docker_py_versioninfo` were not set at that time.

This commit fixes that by putting the environment variable parsing after those two.

* This moves the lines in the code that parse the `env` and `env_file` options for docker to the end of the `__init__()` function.
This is needed because the `_check_capabilites` function needs both a working `self.client` and a proper `self.docker_py_versioninfo`.
`_check_capabilities` is used by `ensure_capabilities` which is, in turn, used by `get_environment`

This means that before this commit, the environment variables could not be loaded because both `self.client` and `self.docker_py_versioninfo` were not set at that time.

This commit fixes that by putting the environment variable parsing after those two.
2016-12-08 11:24:36 -05:00
chouseknecht fc486824b8 Fix issue #3866 2016-12-08 11:24:35 -05:00
pic 8494b0af4b fix #3528 : dns type 2016-12-08 11:24:34 -05:00
chouseknecht 9549c66a56 Fix #147 automatically expose published ports 2016-12-08 11:24:34 -05:00
chouseknecht 17fc0f11db Remove unused method in ContainerManager 2016-12-08 11:24:34 -05:00
Mike Mars e2dbd0f445 Fixing Docker compile time errors irt exception handling for Python 3 2016-12-08 11:24:34 -05:00
chouseknecht ec9f56d8e0 Fix #3822 stop container 2016-12-08 11:24:33 -05:00
chouseknecht c9e4955d38 Remove registery option per #3824. 2016-12-08 11:24:33 -05:00
chouseknecht be2d32f04d Fix upate typo and expected volume compare. 2016-12-08 11:24:33 -05:00
chouseknecht 9dd95efe76 Fixed binds and volumes. Now recognizes bound vs unbound as well as named volumes. 2016-12-08 11:24:33 -05:00
Jirayut 'Dear' Nimsaeng d373e0a7c4 Fix volume to support not binding volumes to host 2016-12-08 11:24:33 -05:00
chouseknecht 96192ead02 Remove debug/register from examples. 2016-12-08 11:24:33 -05:00
chouseknecht 3d0d14c5ff Fix network comparison. Fix handling of links. Updated doc strings. Added more examples. 2016-12-08 11:24:33 -05:00
chouseknecht a4bd558240 Set version added to 2.2 so that tests pass 2016-12-08 11:24:32 -05:00
chouseknecht e398efb04f For new options move vesion_added to 2.1.1 2016-12-08 11:24:32 -05:00
chouseknecht c8f63e867a Fixed bug in _get_network_id 2016-12-08 11:24:32 -05:00
chouseknecht a9ddb5023d Fix doc strings. 2016-12-08 11:24:32 -05:00
chouseknecht 1d327a23cd Fixed issues post testing. 2016-12-08 11:24:32 -05:00
chouseknecht 39bfb136a7 First pass at implementing networks parameter. Also added purge_networks option to remove container from networks not included in networks param. 2016-12-08 11:24:32 -05:00
chouseknecht f3c33ee35f Fix for 3768 - adding support for env_file 2016-12-08 11:24:32 -05:00
chouseknecht 2016911e64 Check self.parameters.env exists. 2016-12-08 11:24:32 -05:00
chouseknecht bc665fca9c Fix for issue #3775 - env config comparison 2016-12-08 11:24:32 -05:00
chouseknecht 65e71d8960 Update restart_policy doc strings. 2016-12-08 11:24:32 -05:00
chouseknecht b5666c0f1c Fix restart_poicy 2016-12-08 11:24:32 -05:00
chouseknecht 8f9ef1213d Fix for #3783 - command returns not found or does not exist. 2016-12-08 11:24:32 -05:00
Dan Schmidt c8ec843ac2 Fix "ansbile_facts" typo in docker_container module 2016-12-08 11:24:32 -05:00
chouseknecht d0da544aef Fix for issue 3740. Make docker_service more resilient when targeting older API versions. 2016-12-08 11:24:31 -05:00
Brian Coca f6690828af deprecated docker (#3710)
* deprecated docker

* updated formatting
2016-12-08 11:24:31 -05:00
chouseknecht afc8c42e57 Fixed the URL in description. It's now valid Yaml. 2016-12-08 11:24:29 -05:00
chouseknecht f14d675d2a Remove the U(). 2016-12-08 11:24:29 -05:00
chouseknecht 176363052f Uppercase 2016-12-08 11:24:29 -05:00
chouseknecht 2b4ee0c19d Make the new bits a NOTE 2016-12-08 11:24:29 -05:00
chouseknecht 4ac31f1e8d Where to get the full docker picture. 2016-12-08 11:24:29 -05:00
Shubham 8a6237955d remove module argument, fix #3682 (#3683) 2016-12-08 11:24:29 -05:00
Matt Martz 190f24f30e Revert "Fix doc strings spacing."
This reverts commit 127d518011224289f7917fd3b2ec8ddf73c7dd17.
2016-12-08 11:24:28 -05:00
chouseknecht 26392077c0 Fix doc strings spacing. 2016-12-08 11:24:28 -05:00
chouseknecht 8e6d00f28e Fix doc strings. Missing requirements and doc fragment reference. 2016-12-08 11:24:28 -05:00
chouseknecht d5b82d67b8 Fail gracefully when build path is not found. 2016-12-08 11:24:27 -05:00
chouseknecht 9a021b4181 Fixed files/project_files naming. Correct name is files. 2016-12-08 11:24:27 -05:00
chouseknecht 5837f744e0 Flip version added back to 2.2 to make tests pass. 2016-12-08 11:24:27 -05:00
chouseknecht 018c2f8f73 Moving version added to 2.1 2016-12-08 11:24:27 -05:00
chouseknecht e8d49261e3 Added actions to RETURN docs. Show actions when debug or check mode. 2016-12-08 11:24:27 -05:00
chouseknecht 2860f57551 Removed use of --diff. Replaced 'diff' in output with 'actions'. Only show 'actions' in output if debug true. 2016-12-08 11:24:27 -05:00
chouseknecht be24f83a41 Removed fail method. Combined recreate and force_recreate params. 2016-12-08 11:24:27 -05:00
chouseknecht 50ef604713 Adding docker_service 2016-12-08 11:24:27 -05:00
Chris Houseknecht 8ba5cc4392 Fixed parameters passing in container_create method. (#3618) 2016-12-08 11:24:27 -05:00
Brian Coca c03e1bd2d5 fixed documentation and arg issues 2016-12-08 11:24:26 -05:00
Toshio Kuratomi ed932a53cd Fix documentation 2016-12-08 11:24:26 -05:00
John R Barker d13046a905 ansible-validate-modules part 4: Enable check on ansible-modules-core (#3526)
* Call ansible-validate-modules

* Correct quotes + add newline
2016-12-08 11:24:26 -05:00
chouseknecht 1d6517489b Add doc string for container_limits. Fixed push fail message. Use path type. 2016-12-08 11:24:25 -05:00
Chris Houseknecht b4caa29b00 Adding docker_image_facts (#3493)
* Adding docker_image_facts

* Fix github credentials
2016-12-08 11:24:25 -05:00
Chris Houseknecht bc3391f1f9 Adding docker_container (#3495)
* Adding docker_container

* If state absent, stop the container before attempting to remove. Fixed status running check.

* If container absent, stop before removing. Fix container status check.
2016-12-08 11:24:25 -05:00
Toshio Kuratomi 371d7ec73d Fix docs building 2016-12-08 11:24:25 -05:00
Toshio Kuratomi 5f0dc2b90f Some beginning python3 porting for modules which have unittests 2016-12-08 11:24:24 -05:00
chouseknecht a67e9f3122 Updated version_added on options to reflect options added for 2.1. 2016-12-08 11:24:24 -05:00
chouseknecht f2e7f1935b Clean up and fixes post API version 1.20 testing. 2016-12-08 11:24:24 -05:00
chouseknecht 6f122bdc88 Fix github credentials 2016-12-08 11:24:24 -05:00
chouseknecht f257fb3efa Fix unfriendly exeption handling. 2016-12-08 11:24:23 -05:00
chouseknecht 6aa76b835a Updater per PR comments 2016-12-08 11:24:23 -05:00
chouseknecht fd0554c67e Adding refactored docker_image module. 2016-12-08 11:24:23 -05:00
Chris Houseknecht c5b7e456bd Adding docker_login (#3494)
* Adding docker_login

* Set correct version_added.

* Fix github credentials
2016-12-08 11:24:23 -05:00
Darek Kaczyński 08ad68984c Fix for 'cannot unmarshal array into Go value of type string' error about HostConfig Binds (#3496) 2016-12-08 11:24:20 -05:00
ThomasSteinbach a90fd67c7e docker: fix type issue (#3491)
* fix type issue

* fix type issue for 'volumes-from'
2016-12-08 11:24:20 -05:00
Alexey Wasilyev 4971c7fe82 docker: support polling image by digest (#2932) 2016-12-08 11:24:18 -05:00
Fabian von Feilitzsch 32c744e82a make binds a list instead of a dict (to prevent overwriting when copying the same file to two places) (#2294) 2016-12-08 11:24:17 -05:00
Ash Wilson 6e2f724919 Remove myself from the docker module maintainers
Apologies, but I no longer use this module day-to-day myself, and I don't have the bandwidth right now to effectively triage changes in any kind of timely fashion.
2016-12-08 11:24:14 -05:00
Michael Scherer daddfb490b Improve/fix type checking for docker module
tls_* point to files, so should be type=path
count is a int, so tag it as such and avoid converting later
password should be tagged as no_log
2016-12-08 11:24:14 -05:00
Victor Beresnev 2e94affde6 If cmd and entrypoint not set, don't match them
Hello!
I wanted stop the containers matched only by image name, but can't do this, if I not set cmd in playbook.
This behavior confused me.

If cmd or entrypoint is defined for running container, but not defined in playbook, makes matching behavior as this sample:
https://github.com/ansible/ansible-modules-core/blob/devel/cloud/docker/docker.py#L463
2016-12-08 11:24:14 -05:00
Yannig Perré 72d3aab736 Add an example of extra_hosts option. 2016-12-08 11:24:13 -05:00
Schlueter 734811910e Add missing quote in docker documentation 2016-12-08 11:24:11 -05:00
Andrey Gubarev edde3b49cf update docker_image's path param type to 'path'. Fixes #3175 2016-12-08 11:24:10 -05:00
Tobias Gesellchen db14b544a5 add `env_file` support (original code from @vpetersson) 2016-12-08 11:24:09 -05:00
Konstantin Suvorov 762bd3a801 Fix docker container restart
restart_containers(containers.running) may try to restart containers
that are deleted when looping through get_differing_containers()
fix this by refreshing list after first loop
2016-12-08 11:24:07 -05:00
Daan Oosterveld 6b4fbe62de Adds ulimit to the docker module
The ulimit will be specified as a list and separated by colons. The
hard limit is optional, in which case it is equal to the soft limit.

The ulimits are compared to the ulimits of the container and added
or adjusted accordingly on by a reload.

The module ensures that ulimits are available in the capabilities
iff ulimits is passes as a parameter.
2016-12-08 11:24:07 -05:00
Alexey Wasilyev f8adc99196 docker: fix failing in case of empty image tag 2016-12-08 11:24:02 -05:00
Brian Coca b25c2a4261 added note about awslogs version added 2016-12-08 11:23:59 -05:00
jefferson fermo 9d9daeb73c add awslog option in docker log driver. this option is available starting with ansible 2.1 2016-12-08 11:23:59 -05:00
Alexey Wasilyev 4d30ae313d Add cpu_shares option for docker module 2016-12-08 11:23:57 -05:00
Will Rouesnel b565da78b3 docker: Fix state=reloaded to detect default LoggingDriver for docker
Previously the logging module hard coded the default logging driver. This means
if the docker daemon is started with a different logging driver, the ansible
module would continually restart it when run.

This fix adds a call to docker.Client.info(), which is inspected if a logging
driver is not supplied in the playbook, and the container only restarted if
the logging driver applied differs from the configured default.

In usage, this has solved issues with using alternative logging drivers.
2016-12-08 11:23:57 -05:00
Brian Coca 0ca9356675 added versions note in description for new choice 2016-12-08 11:23:56 -05:00
Pavel Derendyaev 3129154a2a Add "timeout" option to Docker module 2016-12-08 11:23:56 -05:00
sebi 76af56eaca added unless stopped option 2016-12-08 11:23:55 -05:00
Manuel Tiago Pereira 057cbacf8a Add support for legacy registries to pull_image().
Since we now have several exceptions to the assumption that the
result of the pull would be on the last status line returned by
docker-py's pull(), I've changed the function so that it looks
through the status lines and returns what if finds on it.
Despite the repeated `break`s, the code seems simpler and a little
more coherent like this. From what I've checked using
`https://github.com/jlafon/ansible-profile`, the execution time is
mostly the same.
2016-12-08 11:23:54 -05:00
Toshio Kuratomi 4fa9de5af3 entrypoint feature added in 2.1 2016-12-08 11:23:54 -05:00
Toshio Kuratomi eb65f819f5 labels is actually not aded in 1.9.4 but in 2.1 2016-12-08 11:23:54 -05:00
Andrew Pashkin c811a3f4bc Add 'entrypoint' parameter to Docker module 2016-12-08 11:23:54 -05:00
Andrew Pashkin 8342397427 Harden matching running containers by "command" in the Docker module
Before this patch:

  - Command was matched if 'Command' field of docker-py
    representation of Docker container ends with 'command' passed
    to Ansible docker module by user.
  - That can give false positives and false negatives.
  - For example:
      a) If 'command' was set up with more than one spaces,
         like 'command=sleep  123', it would be never matched again
         with a container(s) launched by this task.
         Because after launching, command would be normalized and
         appear, in docker-py API call, just as 'sleep 123' - with one
         space. This is false negative case.
      b) If 'entrypoint + command = command', for example
         'sleep + 123 = sleep 123', module would give false positive
         match.

This patch fixes it, by making matching more explicit - against
'Config'->Cmd' field of 'docker inspect' output, provided by docker-py
API and with proper normalization of user input by splitting it to
tokens with 'shlex.split()'.
2016-12-08 11:23:54 -05:00
Omar Khan 369fe78c60 Add stop_timeout option to docker module 2016-12-08 11:23:54 -05:00
Toshio Kuratomi a708ad65c4 Add version_added to documentation 2016-12-08 11:23:54 -05:00
Joe Quadrino b6e2b2dce1 add devices parameter for docker module 2016-12-08 11:23:54 -05:00
Yann Hamon 1faf8dd5c2 Docker module: restarted should update the container when necessary 2016-12-08 11:23:54 -05:00
Brian Coca b4f87ac7fe made note that Z/z are only 2.1 options 2016-12-08 11:23:52 -05:00
Steve Spencer d4aca8eacc Sync up with allowable docker volume mounting modes 2016-12-08 11:23:52 -05:00
Steve Spencer 769d7db1d0 Add support for mounting host volumes with Z and z options 2016-12-08 11:23:52 -05:00
Leonty 22648e88cd Corrected misspelling in the 'labels' docker parameter documentation. 2016-12-08 11:23:52 -05:00
Aaron Boushley 876bdb62e1 Fix issue with comparing versions improperly.
This allows old versions of docker api to function.
2016-12-08 11:23:51 -05:00
Leonty 8638d9d26c Support 'labels' parameter for docker. 2016-12-08 11:23:51 -05:00
Toshio Kuratomi 6f214bccca Add zfil as an owner of the docker module 2016-12-08 11:23:47 -05:00
Toshio Kuratomi edaa4c3f32 Add a new contributor as a maintainer of the docker module 2016-12-08 11:23:47 -05:00
Philippe Jandot 5b7d72e4ef fix regression introduced by f38186ce8b49ea98e29241712da45917a3154e73, and propose a fix for docker facts 2016-12-08 11:23:46 -05:00
Toshio Kuratomi 2619ec5321 Fix issues version_added and chaged => changed typo 2016-12-08 11:23:45 -05:00