-
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 #2 from brainstorm/refresh
Refresh the distribution(s) and docker galaxy dependency
- Loading branch information
Showing
11 changed files
with
98 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
tests/roles | ||
ansible.cfg | ||
*.sw? | ||
*.log |
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
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,2 +1,2 @@ | ||
- src: angstwad.docker_ubuntu | ||
version: v3.4.0 | ||
- src: geerlingguy.docker | ||
version: 2.5.0 |
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,5 +1,6 @@ | ||
--- | ||
- hosts: localhost | ||
- hosts: all | ||
remote_user: root | ||
become: true | ||
roles: | ||
- ansible-ubuntu-ecs-agent |
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,6 +1,21 @@ | ||
--- | ||
# Based on the instructions at http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-install.html | ||
|
||
- name: Make sure python3 pip3 are installed | ||
package: | ||
name: "{{ item }}" | ||
state: latest | ||
with_items: | ||
- python3-pip | ||
- python-pip | ||
|
||
- name: Make sure vital python packages are installed beforehand | ||
pip: | ||
name: "{{ item }}" | ||
state: latest | ||
with_items: | ||
- docker | ||
|
||
- name: Set route_localnet | ||
sysctl: | ||
name: net.ipv4.conf.all.route_localnet | ||
|
@@ -37,6 +52,28 @@ | |
group=root | ||
mode=0644 | ||
|
||
# Uncomment this if you want to operate the docker container via systemd as advised by: | ||
# 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 | ||
|
||
# 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" | ||
|
||
- name: Configure and run the ecs-agent container | ||
docker_container: | ||
name: ecs-agent | ||
|
@@ -50,12 +87,4 @@ | |
- /var/log/ecs/:/log | ||
- /var/lib/ecs/data:/data | ||
env_file: /etc/default/ecs | ||
env: | ||
ECS_LOGFILE: /log/ecs-agent.log | ||
ECS_LOGLEVEL: "{{ ubuntu_ecs_agent_loglevel }}" | ||
ECS_DATADIR: /data | ||
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_RESERVED_PORTS: "{{ ubuntu_ecs_agent_reserved_ports }}" | ||
ECS_CONTAINER_STOP_TIMEOUT: "{{ ubuntu_ecs_agent_container_stop_timeout }}" | ||
privileged: yes # otherwise we get: [WARN] Disabling TaskCPUMemLimit because agent /sys/fs/cgroup/systemd/ecs: read-only file system |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[Unit] | ||
Description=Docker Container %I | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
Restart=always | ||
ExecStartPre=-/usr/bin/docker rm -f %i | ||
ExecStart=/usr/bin/docker run --name %i \ | ||
--restart=on-failure:10 \ | ||
--volume=/var/run:/var/run \ | ||
--volume=/var/log/ecs/:/log \ | ||
--volume=/var/lib/ecs/data:/data \ | ||
--volume=/etc/ecs:/etc/ecs \ | ||
--net=host \ | ||
--env-file=/etc/ecs/ecs.config \ | ||
amazon/amazon-ecs-agent:latest | ||
ExecStop=/usr/bin/docker stop %i | ||
|
||
[Install] | ||
WantedBy=default.target |
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,2 +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_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_RESERVED_PORTS={{ ubuntu_ecs_agent_reserved_ports }} | ||
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 }} |