DCD-436: Install CloudWatch agent on AWS instances.

This commit is contained in:
Steve Smith
2019-09-10 12:31:17 +10:00
parent 2dd332f714
commit cca50a4d9d
4 changed files with 11 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
# 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_cloudwatch_agent_rpm: "https://s3.{{ aws_download_region }}.amazonaws.com/amazoncloudwatch-agent-{{ aws_download_region }}/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm"

View File

@@ -10,7 +10,8 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
@pytest.mark.parametrize('exe', [ @pytest.mark.parametrize('exe', [
'/usr/bin/ec2-metadata', '/usr/bin/ec2-metadata',
'/usr/bin/amazon-ssm-agent', '/usr/bin/amazon-ssm-agent',
'/sbin/mount.efs' '/sbin/mount.efs',
'/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent'
]) ])
def test_package_exes(host, exe): def test_package_exes(host, exe):
assert host.file(exe).exists assert host.file(exe).exists

View File

@@ -6,3 +6,4 @@
- ec2-utils - ec2-utils
- amazon-ssm-agent - amazon-ssm-agent
- amazon-efs-utils - amazon-efs-utils
- "{{ aws_cloudwatch_agent_rpm }}"

View File

@@ -1,13 +1,13 @@
--- ---
- name: Install distro-specific prerequisites
include_tasks: "{{ ansible_distribution|lower }}.yml"
- name: Fetch local EC2 metadata - name: Fetch local EC2 metadata
ec2_metadata_facts: ec2_metadata_facts:
tags: tags:
- notest - notest
- name: Install distro-specific prerequisites
include_tasks: "{{ ansible_distribution|lower }}.yml"
- name: Use EC2 instance ID for cluster node ID - name: Use EC2 instance ID for cluster node ID
set_fact: set_fact:
atl_cluster_node_id: "{{ ansible_ec2_instance_id }}" atl_cluster_node_id: "{{ ansible_ec2_instance_id }}"