diff --git a/roles/cron/cron_ecs/tasks/ecr-access.yml b/roles/cron/cron_ecs/tasks/ecr-access.yml index 852b3b53..35b5963a 100644 --- a/roles/cron/cron_ecs/tasks/ecr-access.yml +++ b/roles/cron/cron_ecs/tasks/ecr-access.yml @@ -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 diff --git a/roles/cron/cron_ecs/tasks/ecs-task.yml b/roles/cron/cron_ecs/tasks/ecs-task.yml index 21226716..7ce7aa28 100644 --- a/roles/cron/cron_ecs/tasks/ecs-task.yml +++ b/roles/cron/cron_ecs/tasks/ecs-task.yml @@ -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') }}" diff --git a/roles/cron/cron_ecs/tasks/main.yml b/roles/cron/cron_ecs/tasks/main.yml index ca633bb9..d1873e3d 100644 --- a/roles/cron/cron_ecs/tasks/main.yml +++ b/roles/cron/cron_ecs/tasks/main.yml @@ -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: diff --git a/roles/cron/cron_ecs/tasks/networking.yml b/roles/cron/cron_ecs/tasks/networking.yml index f1df9fbe..babbb7e6 100644 --- a/roles/cron/cron_ecs/tasks/networking.yml +++ b/roles/cron/cron_ecs/tasks/networking.yml @@ -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: diff --git a/roles/cron/cron_ecs/tasks/site.yml b/roles/cron/cron_ecs/tasks/site.yml index 22dbc5e0..f7aafd52 100644 --- a/roles/cron/cron_ecs/tasks/site.yml +++ b/roles/cron/cron_ecs/tasks/site.yml @@ -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. diff --git a/roles/cron/cron_ecs/tasks/subnet-private.yml b/roles/cron/cron_ecs/tasks/subnet-private.yml index 386c615b..3f3ca1af 100644 --- a/roles/cron/cron_ecs/tasks/subnet-private.yml +++ b/roles/cron/cron_ecs/tasks/subnet-private.yml @@ -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: diff --git a/roles/cron/cron_ecs/tasks/subnet-public.yml b/roles/cron/cron_ecs/tasks/subnet-public.yml index a5078e04..c312358e 100644 --- a/roles/cron/cron_ecs/tasks/subnet-public.yml +++ b/roles/cron/cron_ecs/tasks/subnet-public.yml @@ -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: diff --git a/roles/deploy_container/defaults/main.yml b/roles/deploy_container/defaults/main.yml index abe792a5..915cbb26 100644 --- a/roles/deploy_container/defaults/main.yml +++ b/roles/deploy_container/defaults/main.yml @@ -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" @@ -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 @@ -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