-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaybook.yaml
61 lines (54 loc) · 1.73 KB
/
playbook.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
- name: Setup EC2 instance
hosts: all
become: true
tasks:
- name: Update all packages
shell: |
until yum -y update; do
echo "Waiting for yum lock to be released"
sleep 30
done
register: update_result
retries: 5
delay: 30
until: update_result.rc == 0
- name: Install SSM Agent
shell: |
until yum -y install https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm; do
echo "Waiting for yum lock to be released"
sleep 30
done
register: install_ssm
retries: 5
delay: 30
until: install_ssm.rc == 0
- name: Install CloudWatch Agent
shell: |
until yum -y install https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm; do
echo "Waiting for yum lock to be released"
sleep 30
done
register: install_cloudwatch
retries: 5
delay: 30
until: install_cloudwatch.rc == 0
- name: Start CloudWatch Agent
command: sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a start
- name: Check CloudWatch Agent Status
command: sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status
- name: Install AWS Inspector
shell: |
curl -O https://inspector-agent.amazonaws.com/linux/latest/install
sudo bash install
- name: Install Docker
shell: |
until yum -y install docker; do
echo "Waiting for yum lock to be released"
sleep 30
done
- name: Start Docker
systemd:
name: docker
state: started
enabled: yes