Class: Ansible::Ruby::Modules::Docker_service

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

Overview

Consumes docker compose to start, shutdown and scale services. Works with compose versions 1 and 2. Compose can be read from a docker-compose.yml (or .yaml) file or inline using the C(definition) option. See the examples for more details. Supports check mode.

Instance Method Summary collapse

Methods inherited from Base

#ansible_name, #to_h

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

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

Constructor Details

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

Instance Method Details

#build:yes, ...

Returns Use with state I(present) to always build images prior to starting the application.,Same as running docker-compose build with the pull option.,Images will only be rebuilt if Docker detects a change in the Dockerfile or build directory contents.,Use the C(nocache) option to ignore the image cache when performing the build.,If an existing image is replaced, services using the image will be recreated unless C(recreate) is I(never).

Returns:

  • (:yes, :no, nil)

    Use with state I(present) to always build images prior to starting the application.,Same as running docker-compose build with the pull option.,Images will only be rebuilt if Docker detects a change in the Dockerfile or build directory contents.,Use the C(nocache) option to ignore the image cache when performing the build.,If an existing image is replaced, services using the image will be recreated unless C(recreate) is I(never).



50
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 50

attribute :build

#definitionObject?

Returns Provide docker-compose yaml describing one or more services, networks and volumes.,Mutually exclusive with C(project_src) and C(files).

Returns:

  • (Object, nil)

    Provide docker-compose yaml describing one or more services, networks and volumes.,Mutually exclusive with C(project_src) and C(files).



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

attribute :definition

#dependencies:yes, ...

Returns When C(state) is I(present) specify whether or not to include linked services.

Returns:

  • (:yes, :no, nil)

    When C(state) is I(present) specify whether or not to include linked services.



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

attribute :dependencies

#filesObject?

Returns List of file names relative to C(project_src). Overrides docker-compose.yml or docker-compose.yaml.,Files are loaded and merged in the order given.

Returns:

  • (Object, nil)

    List of file names relative to C(project_src). Overrides docker-compose.yml or docker-compose.yaml.,Files are loaded and merged in the order given.



22
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 22

attribute :files

#hostname_check:yes, ...

Returns Whether or not to check the Docker daemon’s hostname against the name provided in the client certificate.

Returns:

  • (:yes, :no, nil)

    Whether or not to check the Docker daemon’s hostname against the name provided in the client certificate.



42
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 42

attribute :hostname_check

#nocache:yes, ...

Returns Use with the build option to ignore the cache during the image build process.

Returns:

  • (:yes, :no, nil)

    Use with the build option to ignore the cache during the image build process.



58
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 58

attribute :nocache

#project_nameObject?

Returns Provide a project name. If not provided, the project name is taken from the basename of C(project_src).,Required when C(definition) is provided.

Returns:

  • (Object, nil)

    Provide a project name. If not provided, the project name is taken from the basename of C(project_src).,Required when C(definition) is provided.



19
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 19

attribute :project_name

#project_srcObject?

Returns Path to a directory containing a docker-compose.yml or docker-compose.yaml file.,Mutually exclusive with C(definition).,Required when no C(definition) is provided.

Returns:

  • (Object, nil)

    Path to a directory containing a docker-compose.yml or docker-compose.yaml file.,Mutually exclusive with C(definition).,Required when no C(definition) is provided.



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

attribute :project_src

#pull:yes, ...

Returns Use with state I(present) to always pull images prior to starting the application.,Same as running docker-compose pull.,When a new image is pulled, services using the image will be recreated unless C(recreate) is I(never).

Returns:

  • (:yes, :no, nil)

    Use with state I(present) to always pull images prior to starting the application.,Same as running docker-compose pull.,When a new image is pulled, services using the image will be recreated unless C(recreate) is I(never).



54
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 54

attribute :pull

#recreate:always, ...

Returns By default containers will be recreated when their configuration differs from the service definition.,Setting to I(never) ignores configuration differences and leaves existing containers unchanged.,Setting to I(always) forces recreation of all existing containers.

Returns:

  • (:always, :never, :smart, nil)

    By default containers will be recreated when their configuration differs from the service definition.,Setting to I(never) ignores configuration differences and leaves existing containers unchanged.,Setting to I(always) forces recreation of all existing containers.



46
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 46

attribute :recreate

#remove_images:all, ...

Returns Use with state I(absent) to remove the all images or only local images.

Returns:

  • (:all, :local, nil)

    Use with state I(absent) to remove the all images or only local images.



62
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 62

attribute :remove_images

#remove_orphansSymbol?

Returns Remove containers for services not defined in the compose file.

Returns:

  • (Symbol, nil)

    Remove containers for services not defined in the compose file.



78
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 78

attribute :remove_orphans

#remove_volumes:yes, ...

Returns Use with state I(absent) to remove data volumes.

Returns:

  • (:yes, :no, nil)

    Use with state I(absent) to remove data volumes.



66
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 66

attribute :remove_volumes

#restarted:yes, ...

Returns Use with state I(present) to restart all containers.

Returns:

  • (:yes, :no, nil)

    Use with state I(present) to restart all containers.



74
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 74

attribute :restarted

#scaleObject?

Returns When C(state) is I(present) scale services. Provide a dictionary of key/value pairs where the key is the name of the service and the value is an integer count for the number of containers.

Returns:

  • (Object, nil)

    When C(state) is I(present) scale services. Provide a dictionary of key/value pairs where the key is the name of the service and the value is an integer count for the number of containers.



32
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 32

attribute :scale

#servicesObject?

Returns When C(state) is I(present) run I(docker-compose up) on a subset of services.

Returns:

  • (Object, nil)

    When C(state) is I(present) run I(docker-compose up) on a subset of services.



29
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 29

attribute :services

#state:absent, ...

Returns Desired state of the project.,Specifying I(present) is the same as running I(docker-compose up).,Specifying I(absent) is the same as running I(docker-compose down).

Returns:

  • (:absent, :present, nil)

    Desired state of the project.,Specifying I(present) is the same as running I(docker-compose up).,Specifying I(absent) is the same as running I(docker-compose down).



25
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 25

attribute :state

#stopped:yes, ...

Returns Use with state I(present) to leave the containers in an exited or non-running state.

Returns:

  • (:yes, :no, nil)

    Use with state I(present) to leave the containers in an exited or non-running state.



70
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 70

attribute :stopped

#timeoutInteger?

Returns timeout in seconds for container shutdown when attached or when containers are already running.

Returns:

  • (Integer, nil)

    timeout in seconds for container shutdown when attached or when containers are already running.



82
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 82

attribute :timeout