bitintheskud.ansible-role-ecs-agent
CentOS ECS Agent Ansible Role
This role helps configure the ECS container agent on standard CentOS 7 servers.
Requirements
- Ansible version 2.2 or newer
- Works on CentOS version 7.4.1708
Role Variables
For more details, check:
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html
ecs_agent_loglevel
:ECS_LOGLEVEL
(Default: info)ecs_agent_cluster_name
:ECS_CLUSTER
(Default: default)ecs_agent_enable_iam_role
:ECS_ENABLE_TASK_IAM_ROLE
(Default: true)ecs_agent_enable_task_iam_role_network_host
:ECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST
(Default: true)ecs_agent_reserved_ports
:ECS_RESERVED_PORTS
(Default: "[22, 2375, 2376, 51678]")ecs_agent_container_stop_timeout
:ECS_CONTAINER_STOP_TIMEOUT
(Default: 30s)ecs_agent_auth_type
:ECS_ENGINE_AUTH_TYPE
(Default: "")ecs_agent_auth_data
:ECS_ENGINE_AUTH_DATA
(Default: "")ecs_agent_data_dir
:ECS_DATADIR
(Default: "/data")ecs_agent_log_file
:ECS_LOGFILE
(Default: "/log/ecs_agent.log")
Dependencies
Docker must be installed and running.
See:
Caveats
This role sets up the AWS ECS agent as suggested in the documentation and adds iptables rules. However, it does not save these iptables rules for you (using iptables-save
or other methods). If you want to save iptables rules so that they remain after a reboot without needing to run Ansible again, you'll need to manage that separately.
Example Playbook
---
- name: AWS ECS Agent Playbook
hosts: all
become: yes
vars:
- ecs_agent_cluster_name: MyClusterName
roles:
- ansible-role-ecs-agent
Plans for Future Versions
- Add Travis CI build checks.
- Support for log drivers. See: https://github.com/open-guides/og-aws#ecs-tips
- Options for cleaning:
ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION This variable sets how long to wait before removing containers from stopped tasks. The default is 3 hours, but it can be lowered to 1 minute.
ECS_DISABLE_IMAGE_CLEANUP Setting this to true disables automatic image cleanup on your container instance.
ECS_IMAGE_CLEANUP_INTERVAL This sets how often the image cleanup process checks for images to delete. The default is every 30 minutes, but it can be reduced to 10 minutes.
ECS_IMAGE_MINIMUM_CLEANUP_AGE This specifies the minimum time an image must have been pulled before it can be removed. The default is 1 hour.
ECS_NUM_IMAGES_DELETE_PER_CYCLE This specifies how many images can be removed in one cleanup cycle. The default is 5, with a minimum of 1.
License
Licensed under the MIT License. See the LICENSE file for more details.