Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow default network mode, as required for windows containers. #59597

Merged
merged 10 commits into from Feb 10, 2020
2 changes: 2 additions & 0 deletions changelogs/fragments/59597-ecs-allow_default_network_mode.yml
@@ -0,0 +1,2 @@
minor_changes:
- ecs_task_definition - Add network_mode=default to support Windows ECS tasks.
10 changes: 7 additions & 3 deletions lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py
Expand Up @@ -60,9 +60,12 @@
description:
- The Docker networking mode to use for the containers in the task.
- C(awsvpc) mode was added in Ansible 2.5
- Windows containers must use network_mode=default, which will utilize docker NAT networking.
ksagle77 marked this conversation as resolved.
Show resolved Hide resolved
- Setting network_mode=default for a Linux container will use bridge mode.
ksagle77 marked this conversation as resolved.
Show resolved Hide resolved
use bridge mode.
ksagle77 marked this conversation as resolved.
Show resolved Hide resolved
required: false
default: bridge
choices: [ 'bridge', 'host', 'none', 'awsvpc' ]
choices: [ 'default', 'bridge', 'host', 'none', 'awsvpc' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the effect of 'default' documented in the description above.

version_added: 2.3
task_role_arn:
description:
Expand Down Expand Up @@ -232,10 +235,11 @@ def register_task(self, family, task_role_arn, execution_role_arn, network_mode,
params = dict(
family=family,
taskRoleArn=task_role_arn,
networkMode=network_mode,
containerDefinitions=container_definitions,
volumes=volumes
)
if network_mode != 'default':
params['networkMode'] = network_mode
if cpu:
params['cpu'] = cpu
if memory:
Expand Down Expand Up @@ -298,7 +302,7 @@ def main():
revision=dict(required=False, type='int'),
force_create=dict(required=False, default=False, type='bool'),
containers=dict(required=False, type='list'),
network_mode=dict(required=False, default='bridge', choices=['bridge', 'host', 'none', 'awsvpc'], type='str'),
network_mode=dict(required=False, default='bridge', choices=['default','bridge', 'host', 'none', 'awsvpc'], type='str'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
network_mode=dict(required=False, default='bridge', choices=['default','bridge', 'host', 'none', 'awsvpc'], type='str'),
network_mode=dict(required=False, default='bridge', choices=['default', 'bridge', 'host', 'none', 'awsvpc'], type='str'),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, didn't realize that. Adding it back, thanks.

task_role_arn=dict(required=False, default='', type='str'),
execution_role_arn=dict(required=False, default='', type='str'),
volumes=dict(required=False, type='list'),
Expand Down