Commit graph

206 commits

Author SHA1 Message Date
Philippe Jandot
8052d49b07 fix regression introduced by f38186ce8b, and propose a fix for docker facts 2015-09-16 16:49:09 +02:00
David Dyball
a0a374b8ca Updated PR based on comments 2015-09-08 16:19:26 +01:00
Toshio Kuratomi
6e5a832dc2 Fix read-only usage to depend on the docker-py and docker server version 2015-09-04 15:59:19 -07:00
Toshio Kuratomi
1f358f349b 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. 2015-09-03 15:39:18 -07:00
Omri Iluz
daf7a0551b 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
2015-08-23 02:29:39 -07:00
Ilya Epifanov
d951172920 fixed memory_limit for docker api version >= 1.19 2015-08-16 18:34:56 +03:00
sebi
599d60efc0 mem_limit client version check 2015-08-06 16:46:01 +03:00
Toshio Kuratomi
1001eae3c8 Set a default value for DEFAULT_DOCKER_API_VERSION so we can create the AnsibleModule without docker-py 2015-08-03 08:44:48 -07:00
Brian Coca
c6da9d0758 added missing version_Added to extra_hosts
fixes #1843
2015-07-30 13:05:00 -04:00
Toshio Kuratomi
2785364ebe Merge pull request #1736 from larsks/bug/docker-version-parse
docker: fix parsing of docker __version__ string
2015-07-29 12:36:37 -07:00
Brian Coca
49400d90ac Merge pull request #1830 from ecliptik/devel
Fix incorrect var name for api_version
2015-07-28 18:25:20 -04:00
Micheal Waltz
b43f236b05 Fix incorrect var name for api_version 2015-07-28 15:11:33 -07:00
Brian Coca
dbdbcb33cc defined DEFAULT_DOCKER_API_VERSION to avoid it erroring out before we send the message that docker.py is missing 2015-07-27 22:33:15 -04:00
Brian Coca
44d23ababd Merge pull request #1767 from ecliptik/devel
Use proper HostConfig element which contains the proper Memory value …
2015-07-27 18:23:33 -04:00
Brian Coca
d91834bdf5 Merge pull request #1763 from larsks/bug/missing-mem-limit
restore mem_limit
2015-07-27 18:22:37 -04:00
Micheal Waltz
613fe54908 Use a if/else instead to avoid loading possibly invalid values for Memory 2015-07-23 12:17:26 -07:00
Micheal Waltz
77d1c896fe 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'].
2015-07-23 11:34:33 -07:00
Johan Haals
1ea03e7182 ensures API compatibility for read_only containers 2015-07-23 16:45:01 +02:00
Johan Haals
851e55b55f changed version_added for read_only param
this feature will be released in 2.0
2015-07-22 08:28:16 +02:00
Johan Haals
8ec6538ad4 Merge remote-tracking branch 'upstream/devel' into docker-read-only-container 2015-07-22 08:27:35 +02:00
Christian Hammerl
b96d304b93 docker: add support to add/drop capabilities 2015-07-21 19:34:24 -04:00
Micheal Waltz
b0b1566b89 Use proper HostConfig element which contians the proper Memory value - fixes #1766 2015-07-21 12:58:58 -07:00
Lars Kellogg-Stedman
6aedc1020e restore mem_limit
mem_limit got lost in the #1744; this restores it.  Thanks to @dgromov
for the report.
2015-07-21 11:52:48 -04:00
Johan Haals
38f01b52e8 Added support for --read-only Docker containers
Adds support for mounting the container's root filesystem as read only.
2015-07-21 14:24:07 +02:00
Brian Coca
88167a5dac minor doc fixes to docker_user 2015-07-20 21:18:49 -04:00
Brian Coca
5240124525 Merge pull request #361 from simono/docker-add-user
Add option docker_user for docker module.
2015-07-20 21:17:42 -04:00
Brian Coca
030d6d645c added version_Added for new signal option in docker module 2015-07-20 20:53:59 -04:00
Brian Coca
ac28f16126 Merge pull request #1014 from nemunaire/docker-kill-signal
[Docker] Add signal parameter when killing container
2015-07-20 20:52:49 -04:00
Brian Coca
2441928484 corrected v ersion added 2015-07-20 20:09:36 -04:00
Daniel Kerwin
d4d78a1998 Too late for 1.8 2015-07-20 21:50:25 +02:00
Daniel Kerwin
a702dbd29a Switch to _cap_ver_req and add cpu_set to create_containers 2015-07-20 21:50:24 +02:00
Daniel Kerwin
a8bc50a11f Renamed to cpu_set 2015-07-20 21:48:39 +02:00
Daniel Kerwin
fca75a9705 Add support for cpusets. Requires docker-py >= 0.6.0 2015-07-20 21:48:39 +02:00
Brian Coca
cf25888e2d Merge pull request #978 from bobrik/faster-docker-updates
[docker] pulling missing docker image before doing anything
2015-07-20 15:33:32 -04:00
Maksim Losev
efb6088c27 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.
2015-07-16 16:38:20 -04:00
Lars Kellogg-Stedman
444a2ad808 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.
2015-07-16 15:25:39 -04:00
Lars Kellogg-Stedman
6672205f49 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.
2015-07-15 21:15:49 -04:00
Lars Kellogg-Stedman
b7e92b3e52 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')
2015-07-15 21:05:13 -04:00
Brian Coca
51b6b725cc Merge pull request #1078 from andrewgdavis/devel
ansible_facts reflects 1.8 output
2015-07-04 15:19:22 -04:00
Brian Coca
afeb3c8d07 Merge pull request #1031 from smashwilson/docker-wait
[docker] Wait for process exit on detached=no.
2015-06-30 00:24:02 -04:00
Brian Coca
5f5f01833f Merge pull request #1508 from tarrychk/issue_1442
Fix computation of port bindings
2015-06-29 23:54:27 -04:00
Brian Coca
038cc05f4e Merge pull request #1609 from smashwilson/default-net-bridge
[docker] Prevent unnecessary reloads due to the net parameter
2015-06-29 23:38:32 -04:00
Brian Coca
ec15b67712 Merge pull request #547 from steveeJ/devel
Fix bind-volumes on docker >= 1.4.0
2015-06-29 20:13:23 -04:00
Simon Olofsson
dc3161dfdd Add option docker_user for docker module.
docker_user can be used to specify the user or UID to use within the
container.
2015-06-26 00:18:56 +02:00
Ash Wilson
29e4a127e1 Default net to 'bridge' in container diff
This prevents an unnecessary reload when the `net` parameter is unspecified
(i.e. almost always).
2015-06-25 17:11:38 -05:00
Toshio Kuratomi
964d731722 Add version_added documentation to log_driver parameter 2015-06-25 08:29:42 -07:00
Toshio Kuratomi
718f32a042 Merge pull request #1405 from ryanwalls/docker-module-log-driver
Add support for --log-driver option that docker released with Docker 1.6
2015-06-25 08:25:46 -07:00
Brian Coca
19f6099777 minor doc fixes 2015-06-17 12:39:14 -04:00
Robin Roth
64fe01178f 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.
2015-06-17 18:01:35 +02:00
Greg DeKoenigsberg
28a869a030 Updating cloud modules with proper github author information 2015-06-15 14:41:22 -04:00