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
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
2 changes: 1 addition & 1 deletion roles/cron/cron_ecs/tasks/ecr-access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- name: Log into Docker registry.
community.docker.docker_login:
registry_url: "{{ cron_ecs.docker_registry_url }}"
registry_url: "https://{{ cron_ecs.docker_registry_name }}"
username: "{{ _docker_registry_username }}"
password: "{{ _docker_registry_password }}"
reauthorize: true
4 changes: 2 additions & 2 deletions roles/cron/cron_ecs/tasks/ecs-task.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
- name: Set task definition name.
set_fact:
ansible.builtin.set_fact:
task_definition_name: "{{ project_name }}_{{ site.folder | regex_replace('[^a-zA-Z0-9_-]', '_') }}_task_{{ entry.job | regex_replace(' ', '_') }}"

- name: Set containers definition for drupal cron tasks.
set_fact:
ansible.builtin.set_fact:
dynamic_task_containers:
- name: "{{ container_name }}"
image: "{{ cron_ecs.docker_registry_name }}/{{ container_name }}:{{ cron_ecs.container_tag | default('latest') }}"
Expand Down
1 change: 0 additions & 1 deletion roles/cron/cron_ecs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
ansible.builtin.include_tasks:
file: networking.yml
when: deploy_operation == 'cleanup'
delegate_to: localhost

- name: Create and push containers for the scheduled ECS tasks.
ansible.builtin.include_tasks:
Expand Down
1 change: 1 addition & 0 deletions roles/cron/cron_ecs/tasks/networking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
when:
- cron_ecs.aws_ecs.vpc_name is defined
- cron_ecs.aws_ecs.vpc_name | length > 0
delegate_to: localhost

- name: Set the VPC id from name.
ansible.builtin.set_fact:
Expand Down
2 changes: 1 addition & 1 deletion roles/cron/cron_ecs/tasks/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
src: "{{ cron_ecs.dockerfile_template }}"
dest: "{{ cron_ecs.docker_build_dir }}/Dockerfile_{{ project_name }}_{{ build_type }}_{{ site.folder }}"

- set_fact:
- ansible.builtin.set_fact:
container_name: "{{ project_name }}_{{ build_type }}_{{ site.folder | regex_replace('[^a-zA-Z0-9_-]', '_') }}_task"

- name: Build and push container image.
Expand Down
1 change: 1 addition & 0 deletions roles/cron/cron_ecs/tasks/subnet-private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
vpc-id: "{{ _aws_ecs_cluster_vpc_id }}"
tag:Name: "{{ subnet }}"
register: _aws_ecs_cluster_private_subnet
delegate_to: localhost

- name: Add private subnet to the list.
ansible.builtin.set_fact:
Expand Down
1 change: 1 addition & 0 deletions roles/cron/cron_ecs/tasks/subnet-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
vpc-id: "{{ _aws_ecs_cluster_vpc_id }}"
tag:Name: "{{ subnet }}"
register: _aws_ecs_cluster_public_subnet
delegate_to: localhost

- name: Add public subnet to the list.
ansible.builtin.set_fact:
Expand Down
21 changes: 11 additions & 10 deletions roles/deploy_container/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ deploy_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
# docker_registry_url: "https://index.docker.io/v1/"
docker_registry_user: example
docker_registry_pass: asdf1234
docker_base_command: "docker image build"
Expand All @@ -30,14 +31,14 @@ deploy_container:
zone: example.com
aws_profile: example2 # might not be the same account
vpc_name: example
#vpc_id: vpc-XXXXXXX # optionally specify VPC ID to use
# vpc_id: vpc-XXXXXXX # optionally specify VPC ID to use
security_groups: [] # list of security groups, accepts names or IDs
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_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
#task_role_arn: "" # required if you set service_enable_ssm to true
# task_role_arn: "" # required if you set service_enable_ssm to true
task_count: 1
task_minimum_count: 1
task_maximum_count: 4
Expand Down Expand Up @@ -70,23 +71,23 @@ deploy_container:
memory: 1024
launch_type: FARGATE
network_mode: awsvpc
#volumes: [] # list of additional volumes to attach
# volumes: [] # list of additional volumes to attach
target_group_name: example # can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen
target_group_protocol: http
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
# Port: 80
# AvailabilityZone: all
# - Id: 10.0.0.2
# Port: 80
# AvailabilityZone: all
health_check:
protocol: http
path: /
response_codes: "200"
# optional additional healthcheck settings
#interval: 60
#healthy_threshold_count: 3
#unhealthy_threshold_count: 5
## optional additional healthcheck settings
# interval: 60
# healthy_threshold_count: 3
# unhealthy_threshold_count: 5
# Requires the deploy IAM user to have the managed AWSCertificateManagerFullAccess and AmazonRoute53FullAccess policies attached
acm: # see https://github.com/codeenigma/ce-provision/tree/1.x/roles/aws/aws_acm
create_cert: false
Expand Down