Commit Graph

573 Commits (301d561420cd80b749db4973ff9a057ea829c9f2)

Author SHA1 Message Date
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
Michael Schuett e61a4f2fb5 Fix message
Previous fix did not actual work. This fix does however.
2016-12-08 11:23:45 -05:00
Michael Schuett 0cefc2358b Handle connection error
Try and help when mac hits a connection error.
2016-12-08 11:23:45 -05:00
Michael Schuett 536bfb521a remove .geturl()
Can't call geturl on a string.
2016-12-08 11:23:45 -05:00
Michael Schuett 6ff693f975 Remove faulty logic
Update logic after splitting the error into two separate messages.
2016-12-08 11:23:45 -05:00
Michael Schuett 5a20bb473b Documentation Fix
Updated documentation to match current module state.
2016-12-08 11:23:44 -05:00
Michael Schuett 8d1f8dacba Improve Message
Give user a course of action in the case where the suggestions do not
work. This will hopefully allow us to work through any further issues
much faster.
2016-12-08 11:23:44 -05:00
Michael Schuett 53294dbaaa Improve Error Reporting
This will hopefully help mac users be able to quickly resolve any issues
they may find when trying to use this module.
2016-12-08 11:23:44 -05:00
Michael Schuett 75a61ae6e1 docker_image TLS
Check commit enables using tls when using the docker_image module. It
also removes the default for docker_url which doesn't allow us to check
for DOCKER_HOST which is a more sane default. This allows you to use
docker_image on OSX but more documentation is needed.
2016-12-08 11:23:44 -05:00
Adam Williamson 83d941da27 fix #2043: strip empty dict from end of 'pull' stream
When pulling an image using Docker 1.8, it seems the output
JSON stream has an empty dict at the very end. This causes
ansible to fail when pulling an image, as it's expecting a
status message in that dict which it uses to determine whether
it had to download the image or not. As a bit of an ugly hack
for that which remains backward compatible, try the last item
in the stream, and if it's an empty dict, take the last-but-one
item instead.

The strip() is needed as the exact value appears to be '{}/r/n';
we could just match that, but it seems like the kind of thing
where maybe it'd happen to just be '{}/n' or '{}' or something
in some cases, so let's just use strip() in case.
2016-12-08 11:23:40 -05:00
Sam Yaple a4a4b6f423 Catch the second occurance of ExposedPorts as well 2016-12-08 11:23:40 -05:00
Sam Yaple 463fb5a058 Don't assume ExposedPorts exists (bug #2257)
A recent change [1] in docker between v1.8.2 and v1.8.3 changed what
is returned in the json when inspecting an image. Five variables which
could have been expected before will now be omited when empty. Only
one of those variables is being addressed in the docker, ExposedPorts.

Unfortunately there was also no API version change on this so this
can't be easily corrected with pinning the API to the older version.

This does a get() which will return None if the variable is not in the
dict formed from the json that was returned. Everything else works the
same way.

[1] 9098628b29
2016-12-08 11:23:40 -05:00
Colin Hutchinson d70c33f932 make a text link into a actual hyperlink
the text link doesn't fit on some screen resolutions. Making it into sphinx hyperlink will solve that
2016-12-08 11:23:39 -05:00
justnom b724bf8f1c Adding additional Docker log drivers.
Adding additional `log_driver` choices:
* journald
* gelf
* fluentd

Compatible with Docker version >= 1.8.0
2016-12-08 11:23:38 -05:00
David Dyball cdff62643b Updated PR based on comments 2016-12-08 11:23:35 -05:00
Toshio Kuratomi b3262479e9 Fix read-only usage to depend on the docker-py and docker server version 2016-12-08 11:23:34 -05:00
Toshio Kuratomi 13ab511642 We had two separate methods trying to do the same thing but neither one was complete. This merges them so that all of the options get parsed and applied. 2016-12-08 11:23:34 -05:00
Omri Iluz 1c6acc3e8f No need for .keys on volumes list
Since c3f92cca21 changed "volumes" to be a list instead of a dictionary, we don't need (and cannot) .keys when appending to set.
Reported as bug #1957
2016-12-08 11:23:33 -05:00
Ilya Epifanov cbbf284a74 fixed memory_limit for docker api version >= 1.19 2016-12-08 11:23:32 -05:00
sebi ce1afd01e0 mem_limit client version check 2016-12-08 11:23:30 -05:00
Toshio Kuratomi 98e600961f Set a default value for DEFAULT_DOCKER_API_VERSION so we can create the AnsibleModule without docker-py 2016-12-08 11:23:29 -05:00
Brian Coca 9241955076 added missing version_Added to extra_hosts fixes #1843 2016-12-08 11:23:27 -05:00
Micheal Waltz 5f0d989973 Fix incorrect var name for api_version 2016-12-08 11:23:27 -05:00
Brian Coca 92dfe33021 defined DEFAULT_DOCKER_API_VERSION to avoid it erroring out before we send the message that docker.py is missing 2016-12-08 11:23:26 -05:00
Micheal Waltz 950701ba3e Use a if/else instead to avoid loading possibly invalid values for Memory 2016-12-08 11:23:25 -05:00
Micheal Waltz af5e402b87 Set the API version when checking differences in containers and use this to determine the location of the Memory value depending on the version used.
In v1.18 and earlier it was ['Config']['Memory'], but in v1.19 it
changed to ['HostConfig']['Memory'].
2016-12-08 11:23:25 -05:00
Micheal Waltz f36666ae1d Use proper HostConfig element which contians the proper Memory value - fixes #1766 2016-12-08 11:23:25 -05:00
Lars Kellogg-Stedman 3d79d96a1b restore mem_limit
mem_limit got lost in the #1744; this restores it.  Thanks to @dgromov
for the report.
2016-12-08 11:23:25 -05:00
Lars Kellogg-Stedman 562341049e docker: fix parsing of docker __version__ string
If `docker.__version__` contains non-digit characters, such as:

    >>> import docker
    >>> docker.__version__
    '1.4.0-dev'

Then `get_docker_py_versioninfo` will fail with:

    ValueError: invalid literal for int() with base 10: '0-de'

This patch corrects the parsing of the version string so that
`get_docker_py_versioninfo` in this example would return:

    (1, 4, 0, '-dev')
2016-12-08 11:23:25 -05:00
Johan Haals 6a9a4d905a ensures API compatibility for read_only containers 2016-12-08 11:23:24 -05:00
Johan Haals c88feaff7e changed version_added for read_only param
this feature will be released in 2.0
2016-12-08 11:23:24 -05:00
Johan Haals 6231a9d52f Added support for --read-only Docker containers
Adds support for mounting the container's root filesystem as read only.
2016-12-08 11:23:24 -05:00
Christian Hammerl 426ec96ea5 docker: add support to add/drop capabilities 2016-12-08 11:23:23 -05:00
Brian Coca 1976ed931a minor doc fixes to docker_user 2016-12-08 11:23:23 -05:00
Brian Coca b62a6f01ab added version_Added for new signal option in docker module 2016-12-08 11:23:23 -05:00
Brian Coca 07fedaa03a corrected v ersion added 2016-12-08 11:23:23 -05:00
Daniel Kerwin 277065a302 Too late for 1.8 2016-12-08 11:23:23 -05:00
Daniel Kerwin 3a68101fa3 Switch to _cap_ver_req and add cpu_set to create_containers 2016-12-08 11:23:23 -05:00
nemunaire f37510ebaa Add optional signal parameter when killing docker container 2016-12-08 11:23:23 -05:00
Daniel Kerwin 5b029bde98 Renamed to cpu_set 2016-12-08 11:23:22 -05:00
Daniel Kerwin 940baa92a6 Add support for cpusets. Requires docker-py >= 0.6.0 2016-12-08 11:23:22 -05:00
Maksim Losev 482d8da2dc Use HostConfig object when creating container with Docker Remote API > 1.15
This is mlosev's patch (from #1208), rebased against devel as of
2790af2.  It resolves #1707, which was caused by an API incompatibility
between the docker module and server API version 1.19.
2016-12-08 11:23:21 -05:00
Lars Kellogg-Stedman e031efd82c Do not erroneously mask exceptions
There was a catch-all `except` statement in `create_containers`:

        try:
            containers = do_create(count, params)
        except:
            self.pull_image()
            containers = do_create(count, params)

This would mask a variety of errors that should be exposed, including
API compatability errors (as in #1707) and common Python exceptions (KeyError, ValueError, etc) that could result from errors in the code.

This change makes the `except` statement more specific, and only attempts to pull the image and start a container if the original create attempt failed due to a 404 error from the docker API.
2016-12-08 11:23:21 -05:00
Lars Kellogg-Stedman 6116e4cdab docker: permit empty or false pid
The `docker` Python module only accepts `None` or `'host'` as arguments.
This makes it difficult to conditionally set the `pid` attribute using
standard Ansible syntax.

This change converts any value that evaluates as boolean `False` to
`None`, which includes empty strings:

    pid:

As well as an explicit `false`:

    pid: false

This permits the following to work as intended:

    - hosts: localhost
      tasks:
      - name: starting container
        docker:
          docker_api_version: 1.18
          image: larsks/mini-httpd
          name: web
          pid: "{{ container_pid|default('') }}"

If `container_pid` is set to `host` somewhere, this will create a
Docker container with `pid=host`; otherwise, this will create a
container with normal isolated pid namespace.
2016-12-08 11:23:21 -05:00
Ian Babrou 9219aeaaeb Pulling missing docker image before doing anything 2016-12-08 11:23:19 -05:00
Simon Olofsson a3cb6d2f16 Add option docker_user for docker module.
docker_user can be used to specify the user or UID to use within the
container.
2016-12-08 11:23:19 -05:00
Ash Wilson 9f12fd0a26 Default net to 'bridge' in container diff
This prevents an unnecessary reload when the `net` parameter is unspecified
(i.e. almost always).
2016-12-08 11:23:14 -05:00
Ed Hein f11c451bfa Fix computation of port bindings. Port bindings configuration can be a list if several host ports are bound to the same guest port. 2016-12-08 11:23:14 -05:00
Andrew Davis 4d4d911d6e ansible_facts reflects 1.8 output 2016-12-08 11:23:13 -05:00
Ash Wilson ea83727fcf Wait for process exit on detached=no. 2016-12-08 11:23:13 -05:00
Stefan Junker 4ee972190b docker: Use a list instead of a dict for volumes according to the docker-py docs. Do not add host-binds to volumes list. 2016-12-08 11:23:13 -05:00
Stefan Junker 50fe57fff3 Fix bind-volumes on docker >= 1.4.0
If bind-volumes are submitted to docker >= 1.4.0 with the volumes set in addition to the binds, docker will create a regular volume and not bind-mount the specified path.
2016-12-08 11:23:13 -05:00
Toshio Kuratomi 0a3150f7d7 Add version_added documentation to log_driver parameter 2016-12-08 11:23:12 -05:00
Ryan Walls 01a28e7d80 Fix typo in Docker module. 2016-12-08 11:23:12 -05:00
Ryan Walls 9630972c2c Update docker module to avoid false positives when containers are first created. Also have the module check for api compatibility before trying to set a "--log-driver" option. 2016-12-08 11:23:12 -05:00
Ryan Walls f5c1d8141b Set default "log_driver" option to None in docker module. 2016-12-08 11:23:12 -05:00
Ryan Walls 0df1b01cb2 Update docker module to look at log_driver variable when deciding if container configuration has changed. 2016-12-08 11:23:12 -05:00
Ryan Walls 3419a1e253 Add support for --log-driver option that docker released with Docker 1.6 2016-12-08 11:23:12 -05:00
Robin Roth abc89f0df5 add comment: ports need to be exposed.
port mapping with this module only works for ports that are exposed either in the Dockerfile or via an additional arguments. This is different from the command line docker client, that is willing to also map ports that are not exposed.

This comments makes the behaviour more obvious.
2016-12-08 11:23:09 -05:00
Greg DeKoenigsberg 18ca7aee07 Updating cloud modules with proper github author information 2016-12-08 11:23:07 -05:00
Andrew Pashkin a960caae96 Add 'docker_api_version' to docker_image
By default docker-py uses latest version of Docker API. This is not
always desireable, and this patch adds option to specify version, that
should be used.
2016-12-08 11:23:02 -05:00
Pierre Baillet eba0f12769 Support optional dockerfile name 2016-12-08 11:22:59 -05:00
Toshio Kuratomi 5336217649 Several cleanups to many modules:
* Fix docs to specify when python2.6+ is required (due to a library
  dep).  This helps us know when it is okay to use python2.6+ syntax in
  the file.
* remove BabyJson returns.  See #1211  This commit fixes all but the
  openstack modules.
* Use if __name__ == '__main__' to only run the main part of the module
  if the module is run as a program.  This allows for the potential to
  unittest the code later.
2016-12-08 11:22:58 -05:00
Ratnadeep Debnath a99d7da0c1 Fixed typo in cloud docker module. 2016-12-08 11:22:57 -05:00
Toshio Kuratomi c2bf2c7c54 Fix error when container has no names.
Rename loop variable from "i" to more informative "container"

Fixes #1188
2016-12-08 11:22:57 -05:00
Toshio Kuratomi 8bc34613bc Second try at fixing #1227 -- set e default value earlier 2016-12-08 11:22:56 -05:00
Toshio Kuratomi 030858df67 Return empty list if an image has no repo_tags 2016-12-08 11:22:56 -05:00
Toshio Kuratomi 0d468a3aa0 Get docker's default api version definition from both 1.2 location and pre-1.2 location
Fixes #1227
2016-12-08 11:22:56 -05:00
Brian Coca 018b0118dc removed deprecated docs, not true anymore 2016-12-08 11:22:56 -05:00
Toshio Kuratomi 4592b795d9 Only split on the first colon.
Fixes #1214
2016-12-08 11:22:56 -05:00
Heikki Partanen ec566d86b3 Add support for extra_hosts to docker module
extra_hosts parameter (maps to --add-host in 'docker run' syntax) is used
to add host-to-ip mappings to the container.
2016-12-08 11:22:55 -05:00
Ash Wilson c6b0656c1c Record facts for each changed container. 2016-12-08 11:22:52 -05:00
Ryan Trauntvein eaa0ce0ceb Specify that "state: reloaded" was added in Ansible 1.9 2016-12-08 11:22:51 -05:00
Ash Wilson 2dde45cea9 Only fetch details when necessary. 2016-12-08 11:22:50 -05:00
Ash Wilson 93b620ea8a Compare container images to Config.Image. 2016-12-08 11:22:50 -05:00
moncho 0156188a54 Update docker.py
Fix typo that prevents use_tls 'encrypt' option from working properly.
2016-12-08 11:22:49 -05:00
Toshio Kuratomi 5262d768e0 Add another valid status from downloading images 2016-12-08 11:22:49 -05:00
nemunaire 7eebab43ae Convert tuple items to string before format 2016-12-08 11:22:49 -05:00
Toshio Kuratomi d5e3abc5d5 Some code cleanup (removed unused variables and imports) 2016-12-08 11:22:49 -05:00
Toshio Kuratomi f892ca5b8f Also use DOCKER_TLS_VERIFY env var to turn on tls verification 2016-12-08 11:22:49 -05:00
Toshio Kuratomi 1bb98542d3 Fix a potential bug in docker pull 2016-12-08 11:22:49 -05:00
Toshio Kuratomi 0ad023a0ac When no use_tls is not specified and no tls parameters are given we need to not attempt tls. 2016-12-08 11:22:49 -05:00
Toshio Kuratomi 2e93f8e9f7 Make state=running work for backwards compatibility with 1.8 2016-12-08 11:22:48 -05:00
Toshio Kuratomi 1946f05baf Fix lookup of parameter name to be pid instead of pid_mode 2016-12-08 11:22:48 -05:00
Toshio Kuratomi 09a0db1e1f Make pid_mode parameter do minimum docker-py/docker server version checks 2016-12-08 11:22:48 -05:00
Toshio Kuratomi 95df4bcbee Fix for problems found by @dguerri
* TLSConfig['verify'] has to be set to False if we're only encrypting the
  connection, not verifying the host.
* tls_hostname was not set if tls_ca_cert was not present

https://github.com/ansible/ansible-modules-core/pull/926#issuecomment-78573877
2016-12-08 11:22:48 -05:00
Toshio Kuratomi 7c261b3954 Implement comments from @smashwilson:
* if tls_ca_cert is set then use tls to verify the server
* take tls_hostname from the environment variable DOCKER_TLS_HOSTNAME
  if it's not specified in the playbook

https://github.com/ansible/ansible-modules-core/pull/926#issuecomment-78542210
2016-12-08 11:22:48 -05:00
Ian Babrou 3bfe9a7b50 fixed: global name 'e' is not defined 2016-12-08 11:22:48 -05:00
Toshio Kuratomi 3284359894 Alternative implementation of tls for docker
Alternative to #854
2016-12-08 11:22:48 -05:00
Toshio Kuratomi a02641b4f3 Documentation style changes 2016-12-08 11:22:48 -05:00
Ian Babrou 005d02b185 not triggering reload for links and not string env variables 2016-12-08 11:22:47 -05:00
Ash Wilson 7c4e8774d8 Use {0}, {1} style format indices for 2.6 compat 2016-12-08 11:22:47 -05:00
Ash Wilson ff0d0ceb70 Expect module env vars to override Dockerfile ones. 2016-12-08 11:22:47 -05:00
Ash Wilson 4e7d766e8f Include bind mounts in VOLUMES check. 2016-12-08 11:22:47 -05:00
Ash Wilson 959d135b60 Exposed ports, env vars, volumes from the image.
This will account for settings that are provided by the hierarchy of
Dockerfiles used to construct your image, rather than only accounting
for settings provided to the module directly.
2016-12-08 11:22:47 -05:00
Ash Wilson 0d822c0c02 Full image inspection and just repo tags
Hat tip to @bobrik.
2016-12-08 11:22:47 -05:00
Sam Yaple 42fd85f041 Updated version and fixed default 2016-12-08 11:22:47 -05:00
Sam Yaple 24f1cf80bd Add pid mode support to docker module
This allows setting the pid namespace for a container. Currently only
the 'host' pid namespace is supported.

This requires Docker 1.4.1 and docker-py 1.0.0
2016-12-08 11:22:47 -05:00
Ash Wilson 1c5601a0b5 Connect to Docker with optional TLS. 2016-12-08 11:22:47 -05:00
Ash Wilson 4224dd1acb Rework docker module states.
Organize each state into a distinct function for readability and composability.
Rework `present` to create but not start containers. Add a `restarted` state
to unconditionally restart a container and a `reloaded` state to restart a
container if and only if its configuration is incorrect. Store our most recent
knowledge about container states in a ContainerSet object. Improve the value
registered by this task to include not only the inspect data from any changed
containers, but also action counters in their native form, a summary message
for all actions taken, and a `reload_reasons` key to store a human-readable
diagnostic to determine why each container was reloaded.
2016-12-08 11:22:47 -05:00
Lorin Hochstein 09e10ea031 Don't pass volumes_from to create_container
Don't pass the volumes_from argument to the Docker create_container method.

If the volumes_from argument is passed to the create_container method, Docker
raises the following exception:

    docker.errors.DockerException: 'volumes_from' parameter has no effect on
    create_container(). It has been moved to start()
2016-12-08 11:22:47 -05:00