---
- hosts: localhost
tasks:
- name: "Create task definition"
ecs_taskdefinition:
containers:
- name: simple-app
cpu: 10
essential: true
image: "httpd:2.4"
memory: 300
mountPoints:
- containerPath: /usr/local/apache2/htdocs
sourceVolume: my-vol
portMappings:
- containerPort: 80
hostPort: 80
- name: busybox
command:
- "echo 'LOL'"
cpu: 10
entryPoint:
- sh
- "-c"
essential: false
image: busybox
memory: 200
volumesFrom:
- sourceContainer: simple-app
volumes:
- name: my-vol
family: test-cluster-taskdef
state: present
register: task_output
- debug: var=task_output
$ ansible-playbook playbooks/create-ecs-taskdefinition.yml
PLAY [localhost] ***************************************************************
TASK [setup] *******************************************************************ok: [localhost]
TASK [Create task definition] **************************************************ok: [localhost]
TASK [debug] *******************************************************************ok: [localhost] => { "task_output": { "changed": false, "taskdefinition": { "containerDefinitions": [ { "cpu": 10, "environment": [], "essential": true, "image": "httpd:2.4", "memory": 300, "mountPoints": [ { "containerPath": "/usr/local/apache2/htdocs", "sourceVolume": "my-vol" } ], "name": "simple-app", "portMappings": [ { "containerPort": 80, "hostPort": 80, "protocol": "tcp" } ], "volumesFrom": [] }, { "command": [ "echo 'LOL'" ], "cpu": 10, "entryPoint": [ "sh", "-c" ], "environment": [], "essential": false, "image": "busybox", "memory": 200, "mountPoints": [], "name": "busybox", "portMappings": [], "volumesFrom": [ { "sourceContainer": "simple-app" } ] } ], "family": "test-cluster-taskdef", "revision": 1, "status": "ACTIVE", "taskDefinitionArn": "arn:aws:ecs:eu-west-1:123456789012:task-definition/test-cluster-taskdef:1", "volumes": [ { "host": {}, "name": "my-vol" } ] } }}
PLAY RECAP *********************************************************************localhost : ok=3 changed=0 unreachable=0 failed=0$ ansible --versionansible 2.1.0.0image: "http:2.4"image: "http:2.5"