0

我正在尝试在 ECS 任务中设置几个环境变量,但是这些变量似乎从未被传递(也没有引发任何错误)。

这个功能坏了吗?我已经尝试了很多次,但似乎没有任何效果。

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

例如

- 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"
4

1 回答 1

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!

于 2020-04-21T10:02:48.677 回答