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
Ash Wilson
338bbf6efc
Pull newer image versions when requested.
2016-12-08 11:22:46 -05:00
Ash Wilson
6505ce3940
Another documentation commit.
2016-12-08 11:22:46 -05:00
Brian Coca
5c90040626
undeprecated docker_image until replacement actually arives
2016-12-08 11:22:45 -05:00
Sergey Zhukov
d013652dc7
Fixed broken volumes_from for client API >= 1.10
2016-12-08 11:22:43 -05:00
Marek Chodor
35ab6d15df
Fixes docker.errors.DockerException: 'dns' parameter has no effect on create_container(). It has been moved to start()
2016-12-08 11:22:43 -05:00
Tomer Paz
76ee9a6a04
resolve issue 764
...
https://github.com/ansible/ansible-modules-core/issues/764
added 'domainname' attribute in addition to existing 'hostname'.
That's the most elegant way to delegate domain name to docker-py...
2016-12-08 11:22:41 -05:00
Toshio Kuratomi
dd79a27e73
Spelling and grammar fix
2016-12-08 11:22:39 -05:00
Brian Coca
ed0f5045eb
moved defaulting to module constant to after when it is defined
2016-12-08 11:22:39 -05:00
Lorin Hochstein
88d5f15025
docker: fix volume[s]_from typo
...
Code makes reference to volume_from instead of volumes_from. If volumes_from is
passed as an argument, generates a KeyError.
2016-12-08 11:22:35 -05:00
Jan Weitz
8146b45203
Fixes invalid dictionary access.
2016-12-08 11:22:35 -05:00
Jan Weitz
1b9d0c5987
Fixes version check for docker-py
2016-12-08 11:22:34 -05:00
Toshio Kuratomi
d28cd02ab7
Newstyle class
2016-12-08 11:22:34 -05:00
Toshio Kuratomi
4aaba45e29
Make insecure_registry feature version check against the client API
2016-12-08 11:22:34 -05:00
Maksim Losev
807d964a48
Add insecure_registry to docker-py pull method
...
Starting from docker-py>=0.5.0 it is impossible to work with private registries based on HTTP.
So we need additional parameter to allow pull from insecure registry
Related to ansible/ansible#9111
2016-12-08 11:22:34 -05:00
Toshio Kuratomi
7b74e451d9
Make docker ver checks issue failures rather than silently ignoring
...
Also:
* make client version checks robust for two digit version pieces and
alpha versions
* consolidate version checking code
2016-12-08 11:22:33 -05:00
Ingo Gottwald
f88107bc9b
Add support for new docker restart policies
2016-12-08 11:22:33 -05:00
PikachuEXE
fbba80d72e
~ Add missing documentation for option `email`
2016-12-08 11:22:32 -05:00
Toshio Kuratomi
9472a27345
Clean up the docker module just a little so that we can unittest the get_split_image_tag function
2016-12-08 11:22:27 -05:00
Michael DeHaan
98fdc389d0
Deprecate docker_image, use the docker module to deploy docker images, or shell out to docker to call docker build if you want from a playbook.
2016-12-08 11:22:25 -05:00
Brian Coca
5a467bc72c
added __init__.py to new cloud subcategories so builds work again
2016-12-08 11:22:25 -05:00
Brian Coca
32e85c0944
made subcategories for cloud modules for better organization
2016-12-08 11:22:24 -05:00
Michael DeHaan
213e518165
file extensions!
2016-12-08 11:22:22 -05:00
Michael DeHaan
c7eec45b73
Restructuring.
2016-12-08 11:22:22 -05:00