Class: Ansible::Ruby::Modules::Docker_service
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Docker_service
- 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
-
#build ⇒ :yes, ...
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).
-
#definition ⇒ Object?
Provide docker-compose yaml describing one or more services, networks and volumes.,Mutually exclusive with C(project_src) and C(files).
-
#dependencies ⇒ :yes, ...
When C(state) is I(present) specify whether or not to include linked services.
-
#files ⇒ Object?
List of file names relative to C(project_src).
-
#hostname_check ⇒ :yes, ...
Whether or not to check the Docker daemon’s hostname against the name provided in the client certificate.
-
#nocache ⇒ :yes, ...
Use with the build option to ignore the cache during the image build process.
-
#project_name ⇒ Object?
Provide a project name.
-
#project_src ⇒ Object?
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.
-
#pull ⇒ :yes, ...
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).
-
#recreate ⇒ :always, ...
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.
-
#remove_images ⇒ :all, ...
Use with state I(absent) to remove the all images or only local images.
-
#remove_orphans ⇒ Symbol?
Remove containers for services not defined in the compose file.
-
#remove_volumes ⇒ :yes, ...
Use with state I(absent) to remove data volumes.
-
#restarted ⇒ :yes, ...
Use with state I(present) to restart all containers.
-
#scale ⇒ Object?
When C(state) is I(present) scale services.
-
#services ⇒ Object?
When C(state) is I(present) run I(docker-compose up) on a subset of services.
-
#state ⇒ :absent, ...
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).
-
#stopped ⇒ :yes, ...
Use with state I(present) to leave the containers in an exited or non-running state.
-
#timeout ⇒ Integer?
Timeout in seconds for container shutdown when attached or when containers are already running.
Methods inherited from Base
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
#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).
50 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 50 attribute :build |
#definition ⇒ Object?
Returns 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.
35 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 35 attribute :dependencies |
#files ⇒ Object?
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.
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.
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.
58 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 58 attribute :nocache |
#project_name ⇒ Object?
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.
19 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 19 attribute :project_name |
#project_src ⇒ Object?
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.
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).
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.
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.
62 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 62 attribute :remove_images |
#remove_orphans ⇒ Symbol?
Returns 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.
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.
74 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 74 attribute :restarted |
#scale ⇒ Object?
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.
32 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 32 attribute :scale |
#services ⇒ Object?
Returns 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).
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.
70 |
# File 'lib/ansible/ruby/modules/generated/cloud/docker/docker_service.rb', line 70 attribute :stopped |
#timeout ⇒ Integer?
Returns 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 |