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

@ -19,12 +19,12 @@ DOCUMENTATION = '''
module: ecs_service
short_description: create, terminate, start or stop a service in ecs
description:
- Creates or terminates ecs services.
- Creates or terminates ecs services.
notes:
- the service role specified must be assumable (i.e. have a trust relationship
for the ecs service, ecs.amazonaws.com)
dependecies:
- An IAM role must have been created
- the service role specified must be assumable (i.e. have a trust relationship 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)
dependencies:
- An IAM role must have been created
version_added: "2.0"
author: Mark Chance (@java1guy)
options:
@ -56,11 +56,11 @@ options:
required: false
client_token:
description:
-
- Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 32 ASCII characters are allowed.
required: false
role:
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
delay:
description:
@ -76,25 +76,42 @@ options:
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
ecs_service:
- ecs_service:
state: present
name: console-test-service
cluster: "{{ new_cluster }}"
task_definition: "{{ new_cluster }}-task:{{task_revision}}"
cluster: new_cluster
task_definition: new_cluster-task:1"
desired_count: 0
# Basic provisioning example
- ecs_service:
name: default
state: present
cluster: string
cluster: new_cluster
# Simple example to delete
- ecs_cluster:
- ecs_service:
name: default
state: absent
cluster: string
cluster: new_cluster
'''
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:
import json

View file

@ -18,6 +18,8 @@ DOCUMENTATION = '''
---
module: ecs_service_facts
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:
- Lists or describes services in ecs.
version_added: "2.0"
@ -34,51 +36,44 @@ options:
- The cluster ARNS in which to list the services.
required: false
default: 'default'
service:
description:
- The service to get details for (required if details is true)
required: false
'''
EXAMPLES = '''
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic listing example
- ecs_task:
cluster=test-cluster
task_list=123456789012345678901234567890123456
- ecs_service_facts:
cluster: test-cluster
service: console-test-service
details: "true"
# Basic example of deregistering task
- ecs_task:
state: absent
family: console-test-tdn
revision: 1
# Basic listing example
- ecs_service_facts:
cluster: test-cluster
'''
RETURN = '''
cache_updated:
description: if the cache was updated or not
returned: success, in some cases
type: boolean
sample: True
cache_update_time:
description: time of the last cache update (0 if unknown)
returned: success, in some cases
type: datetime
sample: 1425828348000
stdout:
description: output from apt
returned: success, when needed
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 ..."
services: When details is false, returns an array of service ARNs, else an array of these fields
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.
'''
try:
import json, os
import boto
import botocore
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.ec2 import *
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
@ -171,6 +166,7 @@ def main():
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
from ansible.module_utils.ec2 import *
if __name__ == '__main__':
main()