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

* Allow default network option for network_mode, required for windows containers.

* Add change fragment and param description

* Update changelogs/fragments/59597-ecs-allow_default_network_mode.yml

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Correct descriptions. Remove whitespaces.

* Remove empty line.

* Add single space after comma

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

* Update lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py

Co-Authored-By: Mark Chappell <mchappel@redhat.com>

Co-authored-by: kevinsagle <44478308+kevinsagle@users.noreply.github.com>
Co-authored-by: Mark Chappell <mchappel@redhat.com>
This commit is contained in:
ksagle77 2020-02-10 13:01:13 -05:00 committed by GitHub
parent 231726d38b
commit b9d22b901d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ecs_task_definition - Add network_mode=default to support Windows ECS tasks.

View file

@ -58,9 +58,11 @@ options:
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 I(network_mode=default), which will utilize docker NAT networking.
- Setting I(network_mode=default) for a Linux container will use bridge mode.
required: false
default: bridge
choices: [ 'bridge', 'host', 'none', 'awsvpc' ]
choices: [ 'default', 'bridge', 'host', 'none', 'awsvpc' ]
version_added: 2.3
type: str
task_role_arn:
@ -265,10 +267,11 @@ class EcsTaskManager:
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:
@ -330,7 +333,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'),
task_role_arn=dict(required=False, default='', type='str'),
execution_role_arn=dict(required=False, default='', type='str'),
volumes=dict(required=False, type='list'),