Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1db7fb0
Adding container push and build code.
gregharvey Jun 22, 2023
b45c182
Fixing some minor issues.
gregharvey Jun 22, 2023
6211767
Docs updates and template flexibility improvement.
gregharvey Jun 22, 2023
3eecd60
Creating separate registry name for handling docker push.
gregharvey Jun 22, 2023
a794855
Trying to get the registry name right.
gregharvey Jun 22, 2023
6c6db26
Adding AWS stack components to ECS builds.
gregharvey Jun 27, 2023
21312cf
Force a docker logout.
gregharvey Jun 27, 2023
9005d12
Need to delegate docker commands to the controller.
gregharvey Jun 27, 2023
a609bfb
Trying deleting the credentials file instead.
gregharvey Jun 27, 2023
5990127
Fixing var name in subnet.yml.
gregharvey Jun 27, 2023
40b2687
Missing some ACM variables.
gregharvey Jun 27, 2023
d32257d
Allowing us to set wait timeout for TG creation.
gregharvey Jun 27, 2023
687ff13
Uncommenting cpu and memory vars for ECS with Fargate.
gregharvey Jun 27, 2023
3113716
Missed a variable in ELB creation.
gregharvey Jun 27, 2023
21ece99
Merge branch '1.x' into ecs_deployments-PR-1.x
gregharvey Jun 27, 2023
904c512
Merge branch 'ecs_deployments' into ecs_deployments-PR-1.x
gregharvey Jun 27, 2023
a78b57a
Couple of linting fixes.
gregharvey Jun 27, 2023
d12e26a
Merge branch 'ecs_deployments' into ecs_deployments-PR-1.x
gregharvey Jun 27, 2023
a9162ba
Force building and tagging of containers as an option.
gregharvey Jun 27, 2023
6b58d32
Merge branch '1.x' into ecs_deployments-PR-1.x
gregharvey Jun 27, 2023
dafb13b
Merge branch 'ecs_deployments' into ecs_deployments-PR-1.x
gregharvey Jun 27, 2023
1efac5b
Merge branch '1.x' into ecs_deployments
gregharvey Jun 27, 2023
2bfcb36
Improving docs for deploy_container role.
gregharvey Jun 27, 2023
9468890
Merge branch '1.x' into ecs_deployments
gregharvey Jun 27, 2023
627b2f1
Merge branch '1.x' into ecs_deployments-PR-1.x
gregharvey Jun 27, 2023
5cae9e1
Merge branch 'ecs_deployments' into ecs_deployments-PR-1.x
gregharvey Jun 27, 2023
00e04f9
Providing container description example for ECS.
gregharvey Jun 29, 2023
5574faa
Adding 'force' option to docker builds.
gregharvey Jun 29, 2023
cde4845
Merge branch '1.x' into ecs_deployments-PR-1.x
gregharvey Jun 29, 2023
5b546c1
Merge branch 'ecs_deployments' into ecs_deployments-PR-1.x
gregharvey Jun 29, 2023
d0f02ed
Revert "Adding 'force' option to docker builds."
gregharvey Jun 29, 2023
d6a0aa5
Merge branch 'ecs_deployments' into ecs_deployments-PR-1.x
gregharvey Jun 29, 2023
47a4c7f
Adding options to force ECS component refreshes.
gregharvey Jun 29, 2023
fe9f1b6
Merge branch 'ecs_deployments' into ecs_deployments-PR-1.x
gregharvey Jun 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions docs/roles/deploy_container.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Naturally you can always create custom policies and roles to have tighter access
```yaml
---
deploy_container:
container_name: example
container_name: example-container
container_tag: latest # tag will take format container_name:container_tag
container_force_build: true # force Docker to build and tag a new image
docker_registry_name: index.docker.io/example # combines with container_name to make the full registry name, docker_registry_name/container_name
Expand Down Expand Up @@ -70,9 +70,10 @@ deploy_container:
- example-dev-a
- example-dev-b
security_groups: [] # list of security groups, accepts names or IDs
cluster_name: example
family_name: example
cluster_name: example-cluster
family_name: example-task-definition
task_definition_revision: "" # integer, but must be presented as a string for Jinja2
task_definition_force_create: false # creates a task definition revision every time if set to true
task_count: 1
task_minimum_count: 1
task_maximum_count: 4
Expand All @@ -81,16 +82,29 @@ deploy_container:
service_autoscale_up_cooldown: 120
service_autoscale_down_cooldown: 120
service_autoscale_target_value: 70 # the value to trigger a scaling event at
service_force_refresh: false # forces a refresh of all containers if set to true
execution_role_arn: "arn:aws:iam::000000000000:role/ecsTaskExecutionRole" # ARN of the IAM role to run the task as, must have access to the ECR repository if applicable
containers: [] # list of container definitions, see docs: https://docs.ansible.com/ansible/latest/collections/community/aws/ecs_taskdefinition_module.html#parameter-containers
containers: # list of container definitions, see docs: https://docs.ansible.com/ansible/latest/collections/community/aws/ecs_taskdefinition_module.html#parameter-containers
- name: example-container
essential: true
image: index.docker.io/example:latest
portMappings:
- containerPort: 8080 # should match target_group_port
hostPort: 8080
logConfiguration:
logDriver: awslogs
options:
awslogs-group: /ecs/example-cluster
awslogs-region: eu-west-1
awslogs-stream-prefix: "ecs-example-task"
cpu: 512 # these values can be set globally or per container
memory: 1024
launch_type: FARGATE
network_mode: awsvpc
#volumes: [] # list of additional volumes to attach
target_group_name: example # 32 character limit
target_group_protocol: http
target_group_port: 80
target_group_port: 8080 # ports lower than 1024 will require the app to be configured to run as a privileged user in the Dockerfile
target_group_wait_timeout: 200 # how long to wait for target group events to complete
targets: [] # typically we do not specify targets at this point, this will be handled automatically by the ECS service
#- Id: 10.0.0.2
Expand Down
24 changes: 19 additions & 5 deletions roles/deploy_container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Naturally you can always create custom policies and roles to have tighter access
```yaml
---
deploy_container:
container_name: example
container_name: example-container
container_tag: latest # tag will take format container_name:container_tag
container_force_build: true # force Docker to build and tag a new image
docker_registry_name: index.docker.io/example # combines with container_name to make the full registry name, docker_registry_name/container_name
Expand Down Expand Up @@ -70,9 +70,10 @@ deploy_container:
- example-dev-a
- example-dev-b
security_groups: [] # list of security groups, accepts names or IDs
cluster_name: example
family_name: example
cluster_name: example-cluster
family_name: example-task-definition
task_definition_revision: "" # integer, but must be presented as a string for Jinja2
task_definition_force_create: false # creates a task definition revision every time if set to true
task_count: 1
task_minimum_count: 1
task_maximum_count: 4
Expand All @@ -81,16 +82,29 @@ deploy_container:
service_autoscale_up_cooldown: 120
service_autoscale_down_cooldown: 120
service_autoscale_target_value: 70 # the value to trigger a scaling event at
service_force_refresh: false # forces a refresh of all containers if set to true
execution_role_arn: "arn:aws:iam::000000000000:role/ecsTaskExecutionRole" # ARN of the IAM role to run the task as, must have access to the ECR repository if applicable
containers: [] # list of container definitions, see docs: https://docs.ansible.com/ansible/latest/collections/community/aws/ecs_taskdefinition_module.html#parameter-containers
containers: # list of container definitions, see docs: https://docs.ansible.com/ansible/latest/collections/community/aws/ecs_taskdefinition_module.html#parameter-containers
- name: example-container
essential: true
image: index.docker.io/example:latest
portMappings:
- containerPort: 8080 # should match target_group_port
hostPort: 8080
logConfiguration:
logDriver: awslogs
options:
awslogs-group: /ecs/example-cluster
awslogs-region: eu-west-1
awslogs-stream-prefix: "ecs-example-task"
cpu: 512 # these values can be set globally or per container
memory: 1024
launch_type: FARGATE
network_mode: awsvpc
#volumes: [] # list of additional volumes to attach
target_group_name: example # 32 character limit
target_group_protocol: http
target_group_port: 80
target_group_port: 8080 # ports lower than 1024 will require the app to be configured to run as a privileged user in the Dockerfile
target_group_wait_timeout: 200 # how long to wait for target group events to complete
targets: [] # typically we do not specify targets at this point, this will be handled automatically by the ECS service
#- Id: 10.0.0.2
Expand Down
24 changes: 19 additions & 5 deletions roles/deploy_container/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
deploy_container:
container_name: example
container_name: example-container
container_tag: latest # tag will take format container_name:container_tag
container_force_build: true # force Docker to build and tag a new image
docker_registry_name: index.docker.io/example # combines with container_name to make the full registry name, docker_registry_name/container_name
Expand Down Expand Up @@ -32,9 +32,10 @@ deploy_container:
- example-dev-a
- example-dev-b
security_groups: [] # list of security groups, accepts names or IDs
cluster_name: example
family_name: example
cluster_name: example-cluster
family_name: example-task-definition
task_definition_revision: "" # integer, but must be presented as a string for Jinja2
task_definition_force_create: false # creates a task definition revision every time if set to true
task_count: 1
task_minimum_count: 1
task_maximum_count: 4
Expand All @@ -43,16 +44,29 @@ deploy_container:
service_autoscale_up_cooldown: 120
service_autoscale_down_cooldown: 120
service_autoscale_target_value: 70 # the value to trigger a scaling event at
service_force_refresh: false # forces a refresh of all containers if set to true
execution_role_arn: "arn:aws:iam::000000000000:role/ecsTaskExecutionRole" # ARN of the IAM role to run the task as, must have access to the ECR repository if applicable
containers: [] # list of container definitions, see docs: https://docs.ansible.com/ansible/latest/collections/community/aws/ecs_taskdefinition_module.html#parameter-containers
containers: # list of container definitions, see docs: https://docs.ansible.com/ansible/latest/collections/community/aws/ecs_taskdefinition_module.html#parameter-containers
- name: example-container
essential: true
image: index.docker.io/example:latest
portMappings:
- containerPort: 8080 # should match target_group_port
hostPort: 8080
logConfiguration:
logDriver: awslogs
options:
awslogs-group: /ecs/example-cluster
awslogs-region: eu-west-1
awslogs-stream-prefix: "ecs-example-task"
cpu: 512 # these values can be set globally or per container
memory: 1024
launch_type: FARGATE
network_mode: awsvpc
#volumes: [] # list of additional volumes to attach
target_group_name: example # 32 character limit
target_group_protocol: http
target_group_port: 80
target_group_port: 8080 # ports lower than 1024 will require the app to be configured to run as a privileged user in the Dockerfile
target_group_wait_timeout: 200 # how long to wait for target group events to complete
targets: [] # typically we do not specify targets at this point, this will be handled automatically by the ECS service
#- Id: 10.0.0.2
Expand Down
2 changes: 2 additions & 0 deletions roles/deploy_container/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
state: present
network_mode: "{{ deploy_container.aws_ecs.network_mode }}"
volumes: "{{ deploy_container.aws_ecs.volumes | default(omit) }}"
force_create: "{{ deploy_container.aws_ecs.task_definition_force_create }}"
delegate_to: localhost
when: deploy_container.aws_ecs.enabled

Expand Down Expand Up @@ -294,6 +295,7 @@
security_groups: "{{ deploy_container.aws_ecs.security_groups }}"
assign_public_ip: true # must be true for now - details: https://stackoverflow.com/a/66802973
tags: "{{ deploy_container.aws_ecs.tags }}"
force_new_deployment: "{{ deploy_container.aws_ecs.service_force_refresh }}"
wait: true
delegate_to: localhost
when: deploy_container.aws_ecs.enabled
Expand Down