Commit Graph

170 Commits (d7a0a3b7e39bd34142609f0b886aa6474844d873)

Author SHA1 Message Date
Brian Coca 49400d90ac Merge pull request #1830 from ecliptik/devel
Fix incorrect var name for api_version
9 years ago
Micheal Waltz b43f236b05 Fix incorrect var name for api_version 9 years ago
Brian Coca dbdbcb33cc defined DEFAULT_DOCKER_API_VERSION to avoid it erroring out before we send the message that docker.py is missing 9 years ago
Brian Coca 44d23ababd Merge pull request #1767 from ecliptik/devel
Use proper HostConfig element which contains the proper Memory value …
9 years ago
Brian Coca d91834bdf5 Merge pull request #1763 from larsks/bug/missing-mem-limit
restore mem_limit
9 years ago
Micheal Waltz 613fe54908 Use a if/else instead to avoid loading possibly invalid values for Memory 9 years ago
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'].
9 years ago
Johan Haals 1ea03e7182 ensures API compatibility for read_only containers 9 years ago
Johan Haals 851e55b55f changed version_added for read_only param
this feature will be released in 2.0
9 years ago
Johan Haals 8ec6538ad4 Merge remote-tracking branch 'upstream/devel' into docker-read-only-container 9 years ago
Christian Hammerl b96d304b93 docker: add support to add/drop capabilities 9 years ago
Micheal Waltz b0b1566b89 Use proper HostConfig element which contians the proper Memory value - fixes #1766 9 years ago
Lars Kellogg-Stedman 6aedc1020e restore mem_limit
mem_limit got lost in the #1744; this restores it.  Thanks to @dgromov
for the report.
9 years ago
Johan Haals 38f01b52e8 Added support for --read-only Docker containers
Adds support for mounting the container's root filesystem as read only.
9 years ago
Brian Coca 88167a5dac minor doc fixes to docker_user 9 years ago
Brian Coca 5240124525 Merge pull request #361 from simono/docker-add-user
Add option docker_user for docker module.
9 years ago
Brian Coca 030d6d645c added version_Added for new signal option in docker module 9 years ago
Brian Coca ac28f16126 Merge pull request #1014 from nemunaire/docker-kill-signal
[Docker] Add signal parameter when killing container
9 years ago
Brian Coca 2441928484 corrected v ersion added 9 years ago
Daniel Kerwin d4d78a1998 Too late for 1.8 9 years ago
Daniel Kerwin a702dbd29a Switch to _cap_ver_req and add cpu_set to create_containers 9 years ago
Daniel Kerwin a8bc50a11f Renamed to cpu_set 9 years ago
Daniel Kerwin fca75a9705 Add support for cpusets. Requires docker-py >= 0.6.0 9 years ago
Brian Coca cf25888e2d Merge pull request #978 from bobrik/faster-docker-updates
[docker] pulling missing docker image before doing anything
9 years ago
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.
9 years ago
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.
9 years ago
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.
9 years ago
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')
9 years ago
Brian Coca 51b6b725cc Merge pull request #1078 from andrewgdavis/devel
ansible_facts reflects 1.8 output
9 years ago
Brian Coca afeb3c8d07 Merge pull request #1031 from smashwilson/docker-wait
[docker] Wait for process exit on detached=no.
9 years ago
Brian Coca 5f5f01833f Merge pull request #1508 from tarrychk/issue_1442
Fix computation of port bindings
9 years ago
Brian Coca 038cc05f4e Merge pull request #1609 from smashwilson/default-net-bridge
[docker] Prevent unnecessary reloads due to the net parameter
9 years ago
Brian Coca ec15b67712 Merge pull request #547 from steveeJ/devel
Fix bind-volumes on docker >= 1.4.0
9 years ago
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.
9 years ago
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).
9 years ago
Toshio Kuratomi 964d731722 Add version_added documentation to log_driver parameter 9 years ago
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
9 years ago
Brian Coca 19f6099777 minor doc fixes 9 years ago
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.
9 years ago
Greg DeKoenigsberg 28a869a030 Updating cloud modules with proper github author information 9 years ago
Ed Hein 558f2ace1f Fix computation of port bindings. Port bindings configuration can be a list
if several host ports are bound to the same guest port.
9 years ago
Ryan Walls a2630d40fb Fix typo in Docker module. 9 years ago
Ryan Walls 88eddb13c0 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.
9 years ago
Ryan Walls c95717afe5 Set default "log_driver" option to None in docker module. 9 years ago
Ryan Walls 5f1d88a829 Update docker module to look at log_driver variable when deciding if container configuration has changed. 9 years ago
Ryan Walls 3f679933a6 Add support for --log-driver option that docker released with Docker 1.6 9 years ago
Toshio Kuratomi 60a66a544d 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.
10 years ago
Ian Babrou 501a665060 Pulling missing docker image before doing anything 10 years ago
Ratnadeep Debnath be66acb436 Fixed typo in cloud docker module. 10 years ago
Toshio Kuratomi f444e49dfa Fix error when container has no names.
Rename loop variable from "i" to more informative "container"

Fixes #1188
10 years ago
Pascal Borreli f29a6ec54d Fixed typos 10 years ago
Toshio Kuratomi 1fdf75d49d Second try at fixing #1227 -- set e default value earlier 10 years ago
Toshio Kuratomi e51ea29d8f Return empty list if an image has no repo_tags 10 years ago
Toshio Kuratomi e356692c74 Get docker's default api version definition from both 1.2 location and pre-1.2 location
Fixes #1227
10 years ago
Brian Coca 09aa79c58f Merge pull request #1102 from heiparta/extra_hosts
Add support for extra_hosts to docker module
10 years ago
Toshio Kuratomi e95c0b2df3 Only split on the first colon.
Fixes #1214
10 years ago
Heikki Partanen 91ca2d6386 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.
10 years ago
Andrew Davis f38186ce8b ansible_facts reflects 1.8 output 10 years ago
Ash Wilson 45b067f097 Record facts for each changed container. 10 years ago
Ash Wilson b28459e6f5 Wait for process exit on detached=no. 10 years ago
Ryan Trauntvein 5320cc93e6 Specify that "state: reloaded" was added in Ansible 1.9 10 years ago
nemunaire 7f3df5634a Add optional signal parameter when killing docker container 10 years ago
Ash Wilson 9ce2fc718a Only fetch details when necessary. 10 years ago
Ash Wilson 47f4c3f2e5 Compare container images to Config.Image. 10 years ago
moncho 3421712e05 Update docker.py
Fix typo that prevents use_tls 'encrypt' option from working properly.
10 years ago
Toshio Kuratomi 76198a8223 Merge pull request #961 from nemunaire/fix-docker-version-print
[docker] Fix formating error when remote host doesn't have required version
10 years ago
Toshio Kuratomi e338fef730 Add another valid status from downloading images 10 years ago
nemunaire fce8c21176 Convert tuple items to string before format 10 years ago
Toshio Kuratomi 8658b82de7 Some code cleanup (removed unused variables and imports) 10 years ago
Toshio Kuratomi 34c4e0d495 Also use DOCKER_TLS_VERIFY env var to turn on tls verification 10 years ago
Toshio Kuratomi ceda82603a Merge pull request #947 from ansible/docker-tls-none
When no use_tls is not specified and no tls parameters are given we need to not attempt tls.
10 years ago
Toshio Kuratomi b0d194ea94 Fix a potential bug in docker pull 10 years ago
Toshio Kuratomi 5b4d7a2182 When no use_tls is not specified and no tls parameters are given we need to not attempt tls. 10 years ago
Toshio Kuratomi 45637176dc Merge branch 'volumes_from' of https://github.com/lorin/ansible-modules-core into lorin-volumes_from
Remove volumes_from altogether

Conflicts:
	cloud/docker/docker.py
10 years ago
Toshio Kuratomi e4a5b46cfb Merge pull request #936 from ansible/docker-pid-mode
Make pid_mode parameter do minimum docker-py/docker server version checks
10 years ago
Toshio Kuratomi 81fc92bd66 Make state=running work for backwards compatibility with 1.8 10 years ago
Toshio Kuratomi bddd02bfcb Fix lookup of parameter name to be pid instead of pid_mode 10 years ago
Toshio Kuratomi 9d0d54b9a6 Merge pull request #926 from ansible/docker-tls-alt-854
Alternative implementation of tls for docker
10 years ago
Toshio Kuratomi cf9374f3ea Make pid_mode parameter do minimum docker-py/docker server version checks 10 years ago
Toshio Kuratomi 3a6cc86578 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
10 years ago
Toshio Kuratomi 1add8ed9e5 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
10 years ago
Stefan Junker c3f92cca21 docker: Use a list instead of a dict for volumes according to the docker-py docs. Do not add host-binds to volumes list. 10 years ago
Stefan Junker d8df5da49f merge and resolve conflict in docker.py 10 years ago
Ian Babrou 763f472f5b fixed: global name 'e' is not defined 10 years ago
Toshio Kuratomi 3e0cbc82f1 Alternative implementation of tls for docker
Alternative to #854
10 years ago
Toshio Kuratomi ca32205c7b Documentation style changes 10 years ago
Ian Babrou 9ecfde7551 not triggering reload for links and not string env variables 10 years ago
Ash Wilson 0969fd75c8 Use {0}, {1} style format indices for 2.6 compat 10 years ago
Ash Wilson 19664a96db Expect module env vars to override Dockerfile ones. 10 years ago
Ash Wilson 608ddbea29 Include bind mounts in VOLUMES check. 10 years ago
Ash Wilson 2c58eb3845 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.
10 years ago
Ash Wilson 79db475316 Full image inspection and just repo tags
Hat tip to @bobrik.
10 years ago
Brian Coca 1c0623ab8d Merge pull request #890 from SamYaple/docker-pid-support
Add pid mode support to docker module
10 years ago
Ash Wilson d046425049 Connect to Docker with optional TLS. 10 years ago
Ash Wilson 80aca4b936 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.
10 years ago
Ash Wilson 7490223940 Pull newer image versions when requested. 10 years ago
Ash Wilson fedbea682e Another documentation commit. 10 years ago
Sam Yaple e1e74bdf33 Updated version and fixed default 10 years ago
Sam Yaple 74e922449b 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
10 years ago
Brian Coca b787792908 Merge pull request #679 from marqc/fix_dns_create_container_issue
Fixes docker.errors.DockerException: 'dns' parameter has no effect on create_container()...
10 years ago