-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from nbertram/master
Fix systemd start option and add configurable logging drivers
- Loading branch information
Showing
6 changed files
with
34 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,28 +52,31 @@ | |
group=root | ||
mode=0644 | ||
|
||
# Uncomment this if you want to operate the docker container via systemd as advised by: | ||
# Option 1: Use systemd to start ECS agent container | ||
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_user_data_scripts.html | ||
# | ||
# - name: create systemd docker service for ecs-agent | ||
# template: | ||
# [email protected] | ||
# dest=/etc/systemd/system/[email protected] | ||
# owner=root | ||
# group=root | ||
# mode=0644 | ||
# | ||
# - name: enable ecs-agent systemd service | ||
# systemd: | ||
# name: docker-container@ecs-agent | ||
# enabled: yes | ||
|
||
- name: create systemd docker service for ecs-agent | ||
template: | ||
[email protected] | ||
dest=/etc/systemd/system/[email protected] | ||
owner=root | ||
group=root | ||
mode=0644 | ||
when: ubuntu_ecs_agent_start_mode == "systemd" | ||
|
||
- name: enable ecs-agent systemd service | ||
systemd: | ||
name: docker-container@ecs-agent | ||
enabled: yes | ||
when: ubuntu_ecs_agent_start_mode == "systemd" | ||
|
||
# https://docs.aws.amazon.com/batch/latest/userguide/create-batch-ami.html | ||
- name: Remove the persistent data checkpoint file from ecs-agent | ||
file: | ||
state: absent | ||
path: "/var/lib/ecs/data/ecs_agent_data.json" | ||
|
||
# Option 2: manage ECS agent container with Docker natively | ||
- name: Configure and run the ecs-agent container | ||
docker_container: | ||
name: ecs-agent | ||
|
@@ -87,4 +90,5 @@ | |
- /var/log/ecs/:/log | ||
- /var/lib/ecs/data:/data | ||
env_file: /etc/default/ecs | ||
privileged: yes # otherwise we get: [WARN] Disabling TaskCPUMemLimit because agent /sys/fs/cgroup/systemd/ecs: read-only file system | ||
privileged: yes # otherwise we get: [WARN] Disabling TaskCPUMemLimit because agent /sys/fs/cgroup/systemd/ecs: read-only file system | ||
when: ubuntu_ecs_agent_start_mode == "docker" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
ECS_LOGFILE=/log/ecs-agent.log | ||
ECS_AVAILABLE_LOGGING_DRIVERS=["json-file","awslogs"] | ||
ECS_DATADIR="{{ ubuntu_ecs_agent_data_path }}" | ||
ECS_LOGLEVEL="{{ ubuntu_ecs_agent_loglevel }}" | ||
ECS_AVAILABLE_LOGGING_DRIVERS={{ ubuntu_ecs_agent_logging_drivers | to_json }} | ||
ECS_DATADIR={{ ubuntu_ecs_agent_data_path }} | ||
ECS_LOGLEVEL={{ ubuntu_ecs_agent_loglevel }} | ||
ECS_CLUSTER="{{ ubuntu_ecs_agent_cluster_name }}" | ||
ECS_ENABLE_TASK_IAM_ROLE="{{ ubuntu_ecs_agent_enable_iam_role }}" | ||
ECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST="{{ ubuntu_ecs_agent_enable_task_iam_role_network_host }}" | ||
ECS_ENABLE_TASK_IAM_ROLE={{ ubuntu_ecs_agent_enable_iam_role | to_json }} | ||
ECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST={{ ubuntu_ecs_agent_enable_task_iam_role_network_host | to_json }} | ||
ECS_RESERVED_PORTS={{ ubuntu_ecs_agent_reserved_ports }} | ||
ECS_CONTAINER_STOP_TIMEOUT="{{ ubuntu_ecs_agent_container_stop_timeout }}" | ||
ECS_CONTAINER_STOP_TIMEOUT={{ ubuntu_ecs_agent_container_stop_timeout }} | ||
ECS_ENGINE_AUTH_TYPE={{ ubuntu_ecs_agent_auth_type }} | ||
ECS_ENGINE_AUTH_DATA={{ ubuntu_ecs_agent_auth_data }} |