Class: Ansible::Ruby::Modules::Docker

Inherits:
Base show all
Defined in:
lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb

Overview

This is the original Ansible module for managing the Docker container life cycle. NOTE: Additional and newer modules are available. For the latest on orchestrating containers with Ansible visit our Getting Started with Docker Guide at github.com/ansible/ansible/blob/devel/docsite/rst/guide_docker.rst.

Instance Method Summary collapse

Methods inherited from Base

#ansible_name, #to_h

Methods inherited from Ansible::Ruby::Models::Base

attr_option, attr_options, attribute, #initialize, remove_existing_validations, #to_h, validates

Constructor Details

This class inherits a constructor from Ansible::Ruby::Models::Base

Instance Method Details

#cap_addBoolean?

Returns Add capabilities for the container. Requires docker-py >= 0.5.0.

Returns:

  • (Boolean, nil)

    Add capabilities for the container. Requires docker-py >= 0.5.0.



191
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 191

attribute :cap_add

#cap_dropBoolean?

Returns Drop capabilities for the container. Requires docker-py >= 0.5.0.

Returns:

  • (Boolean, nil)

    Drop capabilities for the container. Requires docker-py >= 0.5.0.



195
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 195

attribute :cap_drop

#commandString?

Returns Command used to match and launch containers.

Returns:

  • (String, nil)

    Command used to match and launch containers.



27
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 27

attribute :command

#countInteger?

Returns Number of matching containers that should be in the desired state.

Returns:

  • (Integer, nil)

    Number of matching containers that should be in the desired state.



12
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 12

attribute :count

#cpu_setObject?

Returns CPUs in which to allow execution. Requires docker-py >= 0.6.0.

Returns:

  • (Object, nil)

    CPUs in which to allow execution. Requires docker-py >= 0.6.0.



188
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 188

attribute :cpu_set

#cpu_sharesInteger?

Returns CPU shares (relative weight). Requires docker-py >= 0.6.0.

Returns:

  • (Integer, nil)

    CPU shares (relative weight). Requires docker-py >= 0.6.0.



210
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 210

attribute :cpu_shares

#detachBoolean?

Returns Enable detached mode to leave the container running in background. If disabled, fail unless the process exits cleanly.

Returns:

  • (Boolean, nil)

    Enable detached mode to leave the container running in background. If disabled, fail unless the process exits cleanly.



131
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 131

attribute :detach

#devicesArray<String>, ...

Returns List of host devices to expose to container.

Returns:

  • (Array<String>, String, nil)

    List of host devices to expose to container



59
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 59

attribute :devices

#dnsObject?

Returns List of custom DNS servers for the container.

Returns:

  • (Object, nil)

    List of custom DNS servers for the container.



128
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 128

attribute :dns

#docker_api_versionString?

Returns Remote API version to use. This defaults to the current default as specified by docker-py.

Returns:

  • (String, nil)

    Remote API version to use. This defaults to the current default as specified by docker-py.



99
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 99

attribute :docker_api_version

#docker_urlString?

Returns URL of the host running the docker daemon. This will default to the env var DOCKER_HOST if unspecified.

Returns:

  • (String, nil)

    URL of the host running the docker daemon. This will default to the env var DOCKER_HOST if unspecified.



75
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 75

attribute :docker_url

#docker_userObject?

Returns Username or UID to use within the container.

Returns:

  • (Object, nil)

    Username or UID to use within the container



103
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 103

attribute :docker_user

#domainnameObject?

Returns Container domain name.

Returns:

  • (Object, nil)

    Container domain name.



118
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 118

attribute :domainname

#emailObject?

Returns Remote API email.

Returns:

  • (Object, nil)

    Remote API email.



112
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 112

attribute :email

#entrypointObject?

Returns Corresponds to “–entrypoint“ option of “docker run“ command and “ENTRYPOINT“ directive of Dockerfile. Used to match and launch containers.

Returns:

  • (Object, nil)

    Corresponds to “–entrypoint“ option of “docker run“ command and “ENTRYPOINT“ directive of Dockerfile. Used to match and launch containers.



24
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 24

attribute :entrypoint

#envHash?

Returns Pass a dict of environment variables to the container.

Returns:

  • (Hash, nil)

    Pass a dict of environment variables to the container.



121
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 121

attribute :env

#env_fileObject?

Returns Pass in a path to a file with environment variable (FOO=BAR). If a key value is present in both explicitly presented (i.e. as ‘env’) and in the environment file, the explicit value will override. Requires docker-py >= 1.4.0.

Returns:

  • (Object, nil)

    Pass in a path to a file with environment variable (FOO=BAR). If a key value is present in both explicitly presented (i.e. as ‘env’) and in the environment file, the explicit value will override. Requires docker-py >= 1.4.0.



125
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 125

attribute :env_file

#exposeArray<Integer>, ...

Returns List of additional container ports to expose for port mappings or links. If the port is already exposed using EXPOSE in a Dockerfile, you don’t need to expose it again.

Returns:

  • (Array<Integer>, Integer, nil)

    List of additional container ports to expose for port mappings or links. If the port is already exposed using EXPOSE in a Dockerfile, you don’t need to expose it again.



39
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 39

attribute :expose

#extra_hostsHash?

Returns Dict of custom host-to-IP mappings to be defined in the container.

Returns:

  • (Hash, nil)

    Dict of custom host-to-IP mappings to be defined in the container



180
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 180

attribute :extra_hosts

#hostnameObject?

Returns Container hostname.

Returns:

  • (Object, nil)

    Container hostname.



115
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 115

attribute :hostname

#imageString

Returns Container image used to match and launch containers.

Returns:

  • (String)

    Container image used to match and launch containers.



16
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 16

attribute :image

#insecure_registryBoolean?

Returns Use insecure private registry by HTTP instead of HTTPS. Needed for docker-py >= 0.5.0.

Returns:

  • (Boolean, nil)

    Use insecure private registry by HTTP instead of HTTPS. Needed for docker-py >= 0.5.0.



184
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 184

attribute :insecure_registry

#labelsObject?

Returns Set container labels. Requires docker >= 1.6 and docker-py >= 1.2.0.

Returns:

  • (Object, nil)

    Set container labels. Requires docker >= 1.6 and docker-py >= 1.2.0.



199
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 199

attribute :labels

Returns List of other containers to link within this container with an optional,alias. Use docker CLI-style syntax: C(redis:myredis).

Returns:

  • (Array<String>, String, nil)

    List of other containers to link within this container with an optional,alias. Use docker CLI-style syntax: C(redis:myredis).



55
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 55

attribute :links

#log_driver:"json-file", ...

Returns You can specify a different logging driver for the container than for the daemon. “json-file” Default logging driver for Docker. Writes JSON messages to file. docker logs command is available only for this logging driver. “none” disables any logging for the container. “syslog” Syslog logging driver for Docker. Writes log messages to syslog. docker logs command is not available for this logging driver. “journald” Journald logging driver for Docker. Writes log messages to “journald”. “gelf” Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. “fluentd” Fluentd logging driver for Docker. Writes log messages to “fluentd” (forward input). “awslogs” (added in 2.1) Awslogs logging driver for Docker. Writes log messages to AWS Cloudwatch Logs. If not defined explicitly, the Docker daemon’s default (“json-file”) will apply. Requires docker >= 1.6.0.

Returns:

  • (:"json-file", :none, :syslog, :journald, :gelf, :fluentd, :awslogs, nil)

    You can specify a different logging driver for the container than for the daemon. “json-file” Default logging driver for Docker. Writes JSON messages to file. docker logs command is available only for this logging driver. “none” disables any logging for the container. “syslog” Syslog logging driver for Docker. Writes log messages to syslog. docker logs command is not available for this logging driver. “journald” Journald logging driver for Docker. Writes log messages to “journald”. “gelf” Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. “fluentd” Fluentd logging driver for Docker. Writes log messages to “fluentd” (forward input). “awslogs” (added in 2.1) Awslogs logging driver for Docker. Writes log messages to AWS Cloudwatch Logs. If not defined explicitly, the Docker daemon’s default (“json-file”) will apply. Requires docker >= 1.6.0.



63
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 63

attribute :log_driver

#log_optHash?

Returns Additional options to pass to the logging driver selected above. See Docker ‘log-driver <docs.docker.com/reference/logging/overview/>` documentation for more information. Requires docker >=1.7.0.

Returns:

  • (Hash, nil)

    Additional options to pass to the logging driver selected above. See Docker ‘log-driver <docs.docker.com/reference/logging/overview/>` documentation for more information. Requires docker >=1.7.0.



67
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 67

attribute :log_opt

#lxc_confObject?

Returns LXC configuration parameters, such as C(lxc.aa_profile:unconfined).

Returns:

  • (Object, nil)

    LXC configuration parameters, such as C(lxc.aa_profile:unconfined).



147
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 147

attribute :lxc_conf

#memory_limitInteger?

Returns RAM allocated to the container as a number of bytes or as a human-readable string like “512MB”. Leave as “0” to specify no limit.

Returns:

  • (Integer, nil)

    RAM allocated to the container as a number of bytes or as a human-readable string like “512MB”. Leave as “0” to specify no limit.



71
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 71

attribute :memory_limit

#nameString?

Returns Name used to match and uniquely name launched containers. Explicit names are used to uniquely identify a single container or to link among containers. Mutually exclusive with a “count” other than “1”.

Returns:

  • (String, nil)

    Name used to match and uniquely name launched containers. Explicit names are used to uniquely identify a single container or to link among containers. Mutually exclusive with a “count” other than “1”.



31
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 31

attribute :name

#netBoolean?

Returns Network mode for the launched container: bridge, none, container:<name|id>,or host. Requires docker >= 0.11.

Returns:

  • (Boolean, nil)

    Network mode for the launched container: bridge, none, container:<name|id>,or host. Requires docker >= 0.11.



158
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 158

attribute :net

#passwordObject?

Returns Remote API password.

Returns:

  • (Object, nil)

    Remote API password.



109
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 109

attribute :password

#pidObject?

Returns Set the PID namespace mode for the container (currently only supports ‘host’). Requires docker-py >= 1.0.0 and docker >= 1.5.0.

Returns:

  • (Object, nil)

    Set the PID namespace mode for the container (currently only supports ‘host’). Requires docker-py >= 1.0.0 and docker >= 1.5.0



162
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 162

attribute :pid

#portsArray<String>, ...

Returns List containing private to public port mapping specification. Use docker ‘CLI-style syntax: C(8000), C(9000:8000), or C(0.0.0.0:9000:8000)’ where 8000 is a container port, 9000 is a host port, and 0.0.0.0 is - a host interface. The container ports need to be exposed either in the Dockerfile or via the C(expose) option.

Returns:

  • (Array<String>, String, nil)

    List containing private to public port mapping specification. Use docker ‘CLI-style syntax: C(8000), C(9000:8000), or C(0.0.0.0:9000:8000)’ where 8000 is a container port, 9000 is a host port, and 0.0.0.0 is - a host interface. The container ports need to be exposed either in the Dockerfile or via the C(expose) option.



35
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 35

attribute :ports

#privilegedBoolean?

Returns Whether the container should run in privileged mode or not.

Returns:

  • (Boolean, nil)

    Whether the container should run in privileged mode or not.



143
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 143

attribute :privileged

#publish_all_portsBoolean?

Returns Publish all exposed ports to the host interfaces.

Returns:

  • (Boolean, nil)

    Publish all exposed ports to the host interfaces.



43
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 43

attribute :publish_all_ports

#pull:missing, ...

Returns Control when container images are updated from the C(docker_url) registry. If “missing,” images will be pulled only when missing from the host; if ‘“always,” the registry will be checked for a newer version of the image’ each time the task executes.

Returns:

  • (:missing, :always, nil)

    Control when container images are updated from the C(docker_url) registry. If “missing,” images will be pulled only when missing from the host; if ‘“always,” the registry will be checked for a newer version of the image’ each time the task executes.



20
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 20

attribute :pull

#read_onlyObject?

Returns Mount the container’s root filesystem as read only.

Returns:

  • (Object, nil)

    Mount the container’s root filesystem as read only



169
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 169

attribute :read_only

#registryString?

Returns Remote registry URL to pull images from.

Returns:

  • (String, nil)

    Remote registry URL to pull images from.



165
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 165

attribute :registry

#restart_policy:no, ...

Returns Container restart policy.,The ‘unless-stopped’ choice is only available starting in Ansible 2.1 and for Docker 1.9 and above.

Returns:

  • (:no, :"on-failure", :always, :"unless-stopped", nil)

    Container restart policy.,The ‘unless-stopped’ choice is only available starting in Ansible 2.1 and for Docker 1.9 and above.



172
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 172

attribute :restart_policy

#restart_policy_retryInteger?

Returns Maximum number of times to restart a container. Leave as “0” for unlimited retries.

Returns:

  • (Integer, nil)

    Maximum number of times to restart a container. Leave as “0” for unlimited retries.



176
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 176

attribute :restart_policy_retry

#signalString?

Returns With the state “killed”, you can alter the signal sent to the container.

Returns:

  • (String, nil)

    With the state “killed”, you can alter the signal sent to the container.



135
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 135

attribute :signal

#state:present, ...

Returns Assert the container’s desired state. “present” only asserts that the matching containers exist. “started” asserts that the matching containers both exist and are running, but takes no action if any configuration has changed. “reloaded” (added in Ansible 1.9) asserts that all matching containers are running and restarts any that have any images or configuration out of date. “restarted” unconditionally restarts (or starts) the matching containers. “stopped” and ‘“killed” stop and kill all matching containers. “absent” stops and then’ removes any matching containers.

Returns:

  • (:present, :started, :reloaded, :restarted, :stopped, :killed, :absent, nil)

    Assert the container’s desired state. “present” only asserts that the matching containers exist. “started” asserts that the matching containers both exist and are running, but takes no action if any configuration has changed. “reloaded” (added in Ansible 1.9) asserts that all matching containers are running and restarts any that have any images or configuration out of date. “restarted” unconditionally restarts (or starts) the matching containers. “stopped” and ‘“killed” stop and kill all matching containers. “absent” stops and then’ removes any matching containers.



139
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 139

attribute :state

#stdin_openBoolean?

Returns Keep stdin open after a container is launched.

Returns:

  • (Boolean, nil)

    Keep stdin open after a container is launched.



150
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 150

attribute :stdin_open

#stop_timeoutInteger?

Returns How many seconds to wait for the container to stop before killing it.

Returns:

  • (Integer, nil)

    How many seconds to wait for the container to stop before killing it.



202
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 202

attribute :stop_timeout

#timeoutInteger?

Returns Docker daemon response timeout in seconds.

Returns:

  • (Integer, nil)

    Docker daemon response timeout in seconds.



206
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 206

attribute :timeout

#tls_ca_certString?

Returns Path to a PEM-encoded certificate authority to secure the Docker connection. This has no effect if use_tls is encrypt.

Returns:

  • (String, nil)

    Path to a PEM-encoded certificate authority to secure the Docker connection. This has no effect if use_tls is encrypt.



91
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 91

attribute :tls_ca_cert

#tls_client_certString?

Returns Path to the PEM-encoded certificate used to authenticate docker client. If specified tls_client_key must be valid.

Returns:

  • (String, nil)

    Path to the PEM-encoded certificate used to authenticate docker client. If specified tls_client_key must be valid



83
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 83

attribute :tls_client_cert

#tls_client_keyString?

Returns Path to the PEM-encoded key used to authenticate docker client. If specified tls_client_cert must be valid.

Returns:

  • (String, nil)

    Path to the PEM-encoded key used to authenticate docker client. If specified tls_client_cert must be valid



87
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 87

attribute :tls_client_key

#tls_hostnameString?

Returns A hostname to check matches what’s supplied in the docker server’s certificate. If unspecified, the hostname is taken from the docker_url.

Returns:

  • (String, nil)

    A hostname to check matches what’s supplied in the docker server’s certificate. If unspecified, the hostname is taken from the docker_url.



95
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 95

attribute :tls_hostname

#ttyBoolean?

Returns Allocate a pseudo-tty within the container.

Returns:

  • (Boolean, nil)

    Allocate a pseudo-tty within the container.



154
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 154

attribute :tty

#ulimitsObject?

Returns ulimits, list ulimits with name, soft and optionally hard limit separated by colons. e.g. nofile:1024:2048 Requires docker-py >= 1.2.0 and docker >= 1.6.0.

Returns:

  • (Object, nil)

    ulimits, list ulimits with name, soft and optionally hard limit separated by colons. e.g. nofile:1024:2048 Requires docker-py >= 1.2.0 and docker >= 1.6.0



214
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 214

attribute :ulimits

#use_tls:no, ...

Returns Whether to use tls to connect to the docker server. “no” means not to use tls (and ignore any other tls related parameters). “encrypt” means to use tls to encrypt the connection to the server. “verify” means to also verify that the server’s certificate is valid for the server (this both verifies the certificate against the CA and that the certificate was issued for that host. If this is unspecified, tls will only be used if one of the other tls options require it.

Returns:

  • (:no, :encrypt, :verify, nil)

    Whether to use tls to connect to the docker server. “no” means not to use tls (and ignore any other tls related parameters). “encrypt” means to use tls to encrypt the connection to the server. “verify” means to also verify that the server’s certificate is valid for the server (this both verifies the certificate against the CA and that the certificate was issued for that host. If this is unspecified, tls will only be used if one of the other tls options require it.



79
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 79

attribute :use_tls

#usernameObject?

Returns Remote API username.

Returns:

  • (Object, nil)

    Remote API username.



106
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 106

attribute :username

#volumesArray<String>, ...

Returns List of volumes to mount within the container,Use docker CLI-style syntax: C(/host:/container),You can specify a read mode for the mount with either C(ro) or C(rw). Starting at version 2.1, SELinux hosts can additionally use C(z) or C(Z) mount options to use a shared or private label for the volume.

Returns:

  • (Array<String>, String, nil)

    List of volumes to mount within the container,Use docker CLI-style syntax: C(/host:/container),You can specify a read mode for the mount with either C(ro) or C(rw). Starting at version 2.1, SELinux hosts can additionally use C(z) or C(Z) mount options to use a shared or private label for the volume.



47
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 47

attribute :volumes

#volumes_fromArray<String>, ...

Returns List of names of containers to mount volumes from.

Returns:

  • (Array<String>, String, nil)

    List of names of containers to mount volumes from.



51
# File 'lib/ansible/ruby/modules/generated/core/cloud/docker/docker.rb', line 51

attribute :volumes_from