0

I'm trying to set a couple of environment variables in an ECS task, however these never seem to be passed (nor are any errors thrown).

Is this feature broken? I have tried numerous times but nothing seems to work.

Using: Ansible v2.9.6 aws-cli v1.16.162 Python v2.7.5

e.g.

- name: Create task def
  ecs_taskdefinition:
    revision: 1
    launch_type: FARGATE
    cpu: 256
    memory: 512
    network_mode: awsvpc
    state: present
    family: simpsons
    execution_role_arn: "arn:aws:iam::XXXXXXXXXXXXXX:role/ecsTaskExecutionRole"
    region: "{{ aws_region }}"
    aws_access_key: "{{ ecs_access_key }}"
    aws_secret_key: "{{ ecs_secret_key }}"
    containers:
      - name: "{{ maven_artifact_id }}"
        image: "XXXXXXXXXXXXXX.dkr.ecr.eu-west-1.amazonaws.com/REPO:TAG"
        environment:
          - name: "PORT"
            value: "443"
        essential: true
        logConfiguration:
          logDriver: "awslogs"
          options:
            awslogs-group: "/ecs/test-cluster-taskdef"
            awslogs-region: "us-west-2"
            awslogs-stream-prefix: "ecs"
user1016765
  • 2,935
  • 2
  • 32
  • 48

1 Answers1

0

OK I found it - the offending line is: 'revision: 1'

Essentially that ECS is going 'no thanks, already got revision 1' and quietly ignoring my changed task definition.

Solution is to completely remove the 'revision' line and bobs-your-uncle its fine (and Ansible won't keep iterating on each deploy because there's still a diff going on).

Really think the Ansible docs should be updated to advise about this!

user1016765
  • 2,935
  • 2
  • 32
  • 48