Files
nvhi-atsila-microservice/ansible/configure_ecs.yml

49 lines
984 B
YAML
Raw Normal View History

2025-07-12 08:51:48 +00:00
---
- name: Configure EC2 for ECS Cluster
hosts: inventory_hosts
become: yes
vars:
ecs_cluster_name: "nvhi-atsila-cluster"
tasks:
2025-07-12 18:36:46 +00:00
- name: Update all packages
yum:
name: '*'
state: latest
2025-07-12 08:51:48 +00:00
- name: Install Docker
2025-07-12 18:36:46 +00:00
yum:
name: docker
state: present
- name: Install ECS init
yum:
name: ecs-init
2025-07-12 08:51:48 +00:00
state: present
- name: Start and enable Docker
service:
name: docker
state: started
enabled: true
2025-07-12 18:36:46 +00:00
- name: Create ECS config directory
file:
path: /etc/ecs
state: directory
mode: '0755'
2025-07-12 08:51:48 +00:00
- name: Write ECS config file
copy:
dest: /etc/ecs/ecs.config
content: |
ECS_CLUSTER={{ ecs_cluster_name }}
2025-07-12 18:36:46 +00:00
ECS_AVAILABLE_LOGGING_DRIVERS=["json-file","awslogs"]
mode: '0644'
2025-07-12 08:51:48 +00:00
2025-07-12 18:36:46 +00:00
- name: Start and enable ECS agent
service:
name: ecs
2025-07-12 08:51:48 +00:00
state: started
2025-07-12 18:36:46 +00:00
enabled: true