1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fix, update the documentation of the modules

This commit is contained in:
Mark Chance 2015-09-28 10:53:26 -06:00 committed by Matt Clay
parent 00bd01c293
commit ac86f8f0ad
2 changed files with 57 additions and 44 deletions

View file

@ -21,9 +21,9 @@ short_description: create, terminate, start or stop a service in ecs
description: description:
- Creates or terminates ecs services. - Creates or terminates ecs services.
notes: notes:
- the service role specified must be assumable (i.e. have a trust relationship - the service role specified must be assumable (i.e. have a trust relationship for the ecs service, ecs.amazonaws.com)
for the ecs service, ecs.amazonaws.com) - for details of the parameters and returns see U(http://boto3.readthedocs.org/en/latest/reference/services/ecs.html)
dependecies: dependencies:
- An IAM role must have been created - An IAM role must have been created
version_added: "2.0" version_added: "2.0"
author: Mark Chance (@java1guy) author: Mark Chance (@java1guy)
@ -56,11 +56,11 @@ options:
required: false required: false
client_token: client_token:
description: description:
- - Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 32 ASCII characters are allowed.
required: false required: false
role: role:
description: description:
- - The name or full Amazon Resource Name (ARN) of the IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service.
required: false required: false
delay: delay:
description: description:
@ -76,25 +76,42 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details. # Note: These examples do not set authentication details, see the AWS Guide for details.
ecs_service: - ecs_service:
state: present state: present
name: console-test-service name: console-test-service
cluster: "{{ new_cluster }}" cluster: new_cluster
task_definition: "{{ new_cluster }}-task:{{task_revision}}" task_definition: new_cluster-task:1"
desired_count: 0 desired_count: 0
# Basic provisioning example # Basic provisioning example
- ecs_service: - ecs_service:
name: default name: default
state: present state: present
cluster: string cluster: new_cluster
# Simple example to delete # Simple example to delete
- ecs_cluster: - ecs_service:
name: default name: default
state: absent state: absent
cluster: string cluster: new_cluster
''' '''
RETURN = ''' RETURN = '''
# Create service
service: On create service, it returns the new values; on delete service, it returns the values for the service being deleted.
clusterArn: The Amazon Resource Name (ARN) of the of the cluster that hosts the service.
desiredCount: The desired number of instantiations of the task definition to keep running on the service.
loadBalancers: A list of load balancer objects
loadBalancerName: the name
containerName: The name of the container to associate with the load balancer.
containerPort: The port on the container to associate with the load balancer.
pendingCount: The number of tasks in the cluster that are in the PENDING state.
runningCount: The number of tasks in the cluster that are in the RUNNING state.
serviceArn: The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service .
serviceName: A user-generated string used to identify the service
status: The valid values are ACTIVE, DRAINING, or INACTIVE.
taskDefinition: The ARN of a task definition to use for tasks in the service.
# Delete service
ansible_facts: When deleting a service, the values described above for the service prior to its deletion are returned.
''' '''
try: try:
import json import json

View file

@ -18,6 +18,8 @@ DOCUMENTATION = '''
--- ---
module: ecs_service_facts module: ecs_service_facts
short_description: list or describe services in ecs short_description: list or describe services in ecs
notes:
- for details of the parameters and returns see U(http://boto3.readthedocs.org/en/latest/reference/services/ecs.html)
description: description:
- Lists or describes services in ecs. - Lists or describes services in ecs.
version_added: "2.0" version_added: "2.0"
@ -34,51 +36,44 @@ options:
- The cluster ARNS in which to list the services. - The cluster ARNS in which to list the services.
required: false required: false
default: 'default' default: 'default'
service:
description:
- The service to get details for (required if details is true)
required: false
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details. # Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic listing example # Basic listing example
- ecs_task: - ecs_service_facts:
cluster=test-cluster cluster: test-cluster
task_list=123456789012345678901234567890123456 service: console-test-service
details: "true"
# Basic example of deregistering task # Basic listing example
- ecs_task: - ecs_service_facts:
state: absent cluster: test-cluster
family: console-test-tdn
revision: 1
''' '''
RETURN = ''' RETURN = '''
cache_updated: services: When details is false, returns an array of service ARNs, else an array of these fields
description: if the cache was updated or not clusterArn: The Amazon Resource Name (ARN) of the of the cluster that hosts the service.
returned: success, in some cases desiredCount: The desired number of instantiations of the task definition to keep running on the service.
type: boolean loadBalancers: A list of load balancer objects
sample: True loadBalancerName: the name
cache_update_time: containerName: The name of the container to associate with the load balancer.
description: time of the last cache update (0 if unknown) containerPort: The port on the container to associate with the load balancer.
returned: success, in some cases pendingCount: The number of tasks in the cluster that are in the PENDING state.
type: datetime runningCount: The number of tasks in the cluster that are in the RUNNING state.
sample: 1425828348000 serviceArn: The Amazon Resource Name (ARN) that identifies the service. The ARN contains the arn:aws:ecs namespace, followed by the region of the service, the AWS account ID of the service owner, the service namespace, and then the service name. For example, arn:aws:ecs:region :012345678910 :service/my-service .
stdout: serviceName: A user-generated string used to identify the service
description: output from apt status: The valid values are ACTIVE, DRAINING, or INACTIVE.
returned: success, when needed taskDefinition: The ARN of a task definition to use for tasks in the service.
type: string
sample: "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following extra packages will be installed:\n apache2-bin ..."
stderr:
description: error output from apt
returned: success, when needed
type: string
sample: "AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to ..."
''' '''
try: try:
import json, os import json, os
import boto import boto
import botocore import botocore
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import *
HAS_BOTO = True HAS_BOTO = True
except ImportError: except ImportError:
HAS_BOTO = False HAS_BOTO = False
@ -171,6 +166,7 @@ def main():
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.urls import * from ansible.module_utils.urls import *
from ansible.module_utils.ec2 import *
if __name__ == '__main__': if __name__ == '__main__':
main() main()