mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
DCD-436: Enable/start CW agent.
This commit is contained in:
@@ -3,3 +3,6 @@
|
|||||||
# See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html
|
# See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html
|
||||||
aws_download_region: "{{ ansible_ec2_placement_region | default('us-west-2') }}"
|
aws_download_region: "{{ ansible_ec2_placement_region | default('us-west-2') }}"
|
||||||
aws_cloudwatch_agent_rpm: "https://s3.{{ aws_download_region }}.amazonaws.com/amazoncloudwatch-agent-{{ aws_download_region }}/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm"
|
aws_cloudwatch_agent_rpm: "https://s3.{{ aws_download_region }}.amazonaws.com/amazoncloudwatch-agent-{{ aws_download_region }}/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm"
|
||||||
|
|
||||||
|
# Mostly for molecule testing, as skip-tags doesn't work with handlers.
|
||||||
|
atl_aws_agent_restart: true
|
||||||
|
|||||||
15
roles/aws_common/handlers/main.yml
Normal file
15
roles/aws_common/handlers/main.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Enable CloudWatch Agent
|
||||||
|
systemd:
|
||||||
|
name: "amazon-cloudwatch-agent.service"
|
||||||
|
daemon_reload: true
|
||||||
|
enabled: true
|
||||||
|
when: atl_aws_agent_restart
|
||||||
|
|
||||||
|
- name: Restart CloudWatch Agent
|
||||||
|
systemd:
|
||||||
|
name: "amazon-cloudwatch-agent.service"
|
||||||
|
enabled: true
|
||||||
|
status: restarted
|
||||||
|
when: atl_aws_agent_restart
|
||||||
@@ -6,5 +6,6 @@
|
|||||||
ansible_default_ipv4:
|
ansible_default_ipv4:
|
||||||
address: "9.9.9.9"
|
address: "9.9.9.9"
|
||||||
ansible_ec2_instance_id: "NONE"
|
ansible_ec2_instance_id: "NONE"
|
||||||
|
atl_aws_agent_restart: false
|
||||||
roles:
|
roles:
|
||||||
- role: aws_common
|
- role: aws_common
|
||||||
|
|||||||
@@ -6,4 +6,10 @@
|
|||||||
- ec2-utils
|
- ec2-utils
|
||||||
- amazon-ssm-agent
|
- amazon-ssm-agent
|
||||||
- amazon-efs-utils
|
- amazon-efs-utils
|
||||||
|
|
||||||
|
- name: Install CloudWatch Agent
|
||||||
|
yum:
|
||||||
|
name:
|
||||||
- "{{ aws_cloudwatch_agent_rpm }}"
|
- "{{ aws_cloudwatch_agent_rpm }}"
|
||||||
|
notify:
|
||||||
|
- Enable CloudWatch Agent
|
||||||
|
|||||||
Reference in New Issue
Block a user