@ -15,7 +15,8 @@ DOCUMENTATION = '''
module : ecs_taskdefinition_facts
module : ecs_taskdefinition_facts
short_description : describe a task definition in ecs
short_description : describe a task definition in ecs
notes :
notes :
- for details of the parameters and returns see U ( http : / / boto3 . readthedocs . io / en / latest / reference / services / ecs . html #ECS.Client.describe_task_definition)
- for details of the parameters and returns see
U ( http : / / boto3 . readthedocs . io / en / latest / reference / services / ecs . html #ECS.Client.describe_task_definition)
description :
description :
- Describes a task definition in ecs .
- Describes a task definition in ecs .
version_added : " 2.5 "
version_added : " 2.5 "
@ -123,7 +124,8 @@ container_definitions:
returned : when present
returned : when present
type : string
type : string
readOnly :
readOnly :
description : If this value is true , the container has read - only access to the volume . If this value is false , then the container can write to the volume .
description : If this value is true , the container has read - only access to the volume .
If this value is false , then the container can write to the volume .
returned : when present
returned : when present
type : bool
type : bool
volumesFrom :
volumesFrom :
@ -136,7 +138,8 @@ container_definitions:
returned : when present
returned : when present
type : string
type : string
readOnly :
readOnly :
description : If this value is true , the container has read - only access to the volume . If this value is false , then the container can write to the volume .
description : If this value is true , the container has read - only access to the volume .
If this value is false , then the container can write to the volume .
returned : when present
returned : when present
type : bool
type : bool
hostname :
hostname :
@ -156,7 +159,8 @@ container_definitions:
returned : when present
returned : when present
type : bool
type : bool
privileged :
privileged :
description : When this parameter is true , the container is given elevated privileges on the host container instance ( similar to the root user ) .
description : When this parameter is true , the container is given elevated
privileges on the host container instance ( similar to the root user ) .
returned : when present
returned : when present
type : bool
type : bool
readonlyRootFilesystem :
readonlyRootFilesystem :
@ -248,7 +252,8 @@ volumes:
returned : when present
returned : when present
type : string
type : string
host :
host :
description : The contents of the host parameter determine whether your data volume persists on the host container instance and where it is stored .
description : The contents of the host parameter determine whether your data volume
persists on the host container instance and where it is stored .
returned : when present
returned : when present
type : bool
type : bool
source_path :
source_path :
@ -293,21 +298,15 @@ placement_constraints:
description : A cluster query language expression to apply to the constraint .
description : A cluster query language expression to apply to the constraint .
returned : when present
returned : when present
type : string
type : string
''' # NOQA
'''
try :
import boto3
HAS_BOTO3 = True
except ImportError :
HAS_BOTO3 = False
from ansible . module_utils . basic import Ansible Module
from ansible . module_utils . aws . core import AnsibleAWSModule
from ansible . module_utils . ec2 import _camel_to_snake, camel_dict_to_snake_dict, boto3_conn , ec2_argument_spec , get_aws_connection_info
from ansible . module_utils . ec2 import camel_dict_to_snake_dict , boto3_conn , ec2_argument_spec , get_aws_connection_info
try :
try :
import botocore
import botocore
except ImportError :
except ImportError :
pass # will be detected by imported HAS_BOTO3
pass # will be detected by imported AnsibleAWSModule
def main ( ) :
def main ( ) :
@ -316,22 +315,18 @@ def main():
task_definition = dict ( required = True , type = ' str ' )
task_definition = dict ( required = True , type = ' str ' )
) )
) )
module = AnsibleModule ( argument_spec = argument_spec , supports_check_mode = True )
module = AnsibleAWSModule ( argument_spec = argument_spec , supports_check_mode = True )
if not HAS_BOTO3 :
module . fail_json ( msg = ' boto3 is required. ' )
region , ec2_url , aws_connect_kwargs = get_aws_connection_info ( module , boto3 = True )
region , ec2_url , aws_connect_kwargs = get_aws_connection_info ( module , boto3 = True )
ecs = boto3_conn ( module , conn_type = ' client ' , resource = ' ecs ' ,
ecs = boto3_conn ( module , conn_type = ' client ' , resource = ' ecs ' ,
region = region , endpoint = ec2_url , * * aws_connect_kwargs )
region = region , endpoint = ec2_url , * * aws_connect_kwargs )
ecs_td = ecs . describe_task_definition ( taskDefinition = module . params [ ' task_definition ' ] ) [ ' taskDefinition ' ]
try :
ecs_td_snake = { }
ecs_td = ecs . describe_task_definition ( taskDefinition = module . params [ ' task_definition ' ] ) [ ' taskDefinition ' ]
for k , v in ecs_td . items ( ) :
except botocore . exceptions . ClientError :
ecs_td _snake[ _camel_to_snake ( k ) ] = v
ecs_td = { }
ecs_td_facts_result = dict ( changed = False , ansible_facts = ecs_td_snake )
module . exit_json ( changed = False , * * camel_dict_to_snake_dict ( ecs_td ) )
module . exit_json ( * * ecs_td_facts_result )
if __name__ == ' __main__ ' :
if __name__ == ' __main__ ' :