mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 08:53:07 -06:00
DCD-436: Make log group unique.
This commit is contained in:
@@ -34,6 +34,14 @@ atl_product_installation_versioned: "{{ atl_product_installation_base }}/{{ atl_
|
|||||||
atl_product_installation_current: "{{ atl_product_installation_base }}/current"
|
atl_product_installation_current: "{{ atl_product_installation_base }}/current"
|
||||||
atl_installer_temp: "{{ atl_installation_base }}/tmp"
|
atl_installer_temp: "{{ atl_installation_base }}/tmp"
|
||||||
|
|
||||||
|
atl_product_log_locations:
|
||||||
|
confluence:
|
||||||
|
- "{{ atl_product_installation_current }}/logs"
|
||||||
|
jira:
|
||||||
|
- "{{ atl_product_installation_current }}/logs"
|
||||||
|
- "{{ atl_product_home }}/logs"
|
||||||
|
stash: []
|
||||||
|
crowd: []
|
||||||
|
|
||||||
# The following are imports from the environment. These are generally
|
# The following are imports from the environment. These are generally
|
||||||
# set in /etc/atl by the CloudFormation template and sourced before
|
# set in /etc/atl by the CloudFormation template and sourced before
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ aws_cloudwatch_agent_rpm: "https://s3.{{ aws_download_region }}.amazonaws.com/am
|
|||||||
|
|
||||||
# Mostly for molecule testing, as skip-tags doesn't work with handlers.
|
# Mostly for molecule testing, as skip-tags doesn't work with handlers.
|
||||||
atl_aws_agent_restart: true
|
atl_aws_agent_restart: true
|
||||||
|
|
||||||
|
atl_aws_log_group: "{{ atl_product_edition }}-{{ atl_aws_stack_name }}"
|
||||||
|
|||||||
@@ -8,13 +8,19 @@ lint:
|
|||||||
platforms:
|
platforms:
|
||||||
- name: amazon_linux2
|
- name: amazon_linux2
|
||||||
image: amazonlinux:2
|
image: amazonlinux:2
|
||||||
|
groups:
|
||||||
|
- aws_node_local
|
||||||
# - name: ubuntu_lts
|
# - name: ubuntu_lts
|
||||||
# image: ubuntu:bionic
|
# image: ubuntu:bionic
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
lint:
|
lint:
|
||||||
name: ansible-lint
|
name: ansible-lint
|
||||||
|
inventory:
|
||||||
|
links:
|
||||||
|
group_vars: ../../../../group_vars/
|
||||||
verifier:
|
verifier:
|
||||||
name: testinfra
|
name: testinfra
|
||||||
lint:
|
lint:
|
||||||
name: flake8
|
name: flake8
|
||||||
|
enabled: false
|
||||||
|
|||||||
@@ -6,6 +6,11 @@
|
|||||||
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_product_family: "jira"
|
||||||
|
atl_product_edition: "jira-software"
|
||||||
|
atl_aws_stack_name: "MY_STACK"
|
||||||
|
|
||||||
atl_aws_agent_restart: false
|
atl_aws_agent_restart: false
|
||||||
roles:
|
roles:
|
||||||
- role: aws_common
|
- role: aws_common
|
||||||
|
|||||||
@@ -15,3 +15,11 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|||||||
])
|
])
|
||||||
def test_package_exes(host, exe):
|
def test_package_exes(host, exe):
|
||||||
assert host.file(exe).exists
|
assert host.file(exe).exists
|
||||||
|
|
||||||
|
|
||||||
|
def test_service_file(host):
|
||||||
|
f = host.file('/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json')
|
||||||
|
assert f.contains('"log_group_name": "jira-software-MY_STACK"')
|
||||||
|
assert f.user == 'root'
|
||||||
|
assert f.group == 'root'
|
||||||
|
assert f.mode == 0o0644
|
||||||
|
|||||||
@@ -12,3 +12,13 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
atl_cluster_node_id: "{{ ansible_ec2_instance_id }}"
|
atl_cluster_node_id: "{{ ansible_ec2_instance_id }}"
|
||||||
atl_local_ipv4: "{{ ansible_ec2_local_ipv4 | default(ansible_default_ipv4.address) }}"
|
atl_local_ipv4: "{{ ansible_ec2_local_ipv4 | default(ansible_default_ipv4.address) }}"
|
||||||
|
|
||||||
|
- name: Generate CloudWatch config
|
||||||
|
template:
|
||||||
|
src: "amazon-cloudwatch-agent.json.j2"
|
||||||
|
dest: "/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify:
|
||||||
|
- Restart CloudWatch Agent
|
||||||
|
|||||||
88
roles/aws_common/templates/amazon-cloudwatch-agent.json.j2
Normal file
88
roles/aws_common/templates/amazon-cloudwatch-agent.json.j2
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"agent": {
|
||||||
|
"metrics_collection_interval": 10,
|
||||||
|
"run_as_user": "root"
|
||||||
|
},
|
||||||
|
|
||||||
|
"logs": {
|
||||||
|
"logs_collected": {
|
||||||
|
"files": {
|
||||||
|
"collect_list": [
|
||||||
|
{% set comma = joiner(',') %}
|
||||||
|
{% for path in atl_product_log_locations[atl_product_family] %}
|
||||||
|
{{ comma() }}
|
||||||
|
{
|
||||||
|
"file_path": "{{ path }}/*",
|
||||||
|
"log_group_name": "{{ atl_aws_log_group }}",
|
||||||
|
"log_stream_name": "{instance_id}"
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"metrics": {
|
||||||
|
"append_dimensions": {
|
||||||
|
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
|
||||||
|
"ImageId": "${aws:ImageId}",
|
||||||
|
"InstanceId": "${aws:InstanceId}",
|
||||||
|
"InstanceType": "${aws:InstanceType}"
|
||||||
|
},
|
||||||
|
"metrics_collected": {
|
||||||
|
"cpu": {
|
||||||
|
"measurement": [
|
||||||
|
"cpu_usage_idle",
|
||||||
|
"cpu_usage_iowait",
|
||||||
|
"cpu_usage_user",
|
||||||
|
"cpu_usage_system"
|
||||||
|
],
|
||||||
|
"metrics_collection_interval": 10,
|
||||||
|
"totalcpu": false
|
||||||
|
},
|
||||||
|
"disk": {
|
||||||
|
"measurement": [
|
||||||
|
"used_percent",
|
||||||
|
"inodes_free"
|
||||||
|
],
|
||||||
|
"metrics_collection_interval": 10,
|
||||||
|
"resources": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diskio": {
|
||||||
|
"measurement": [
|
||||||
|
"io_time",
|
||||||
|
"write_bytes",
|
||||||
|
"read_bytes",
|
||||||
|
"writes",
|
||||||
|
"reads"
|
||||||
|
],
|
||||||
|
"metrics_collection_interval": 10,
|
||||||
|
"resources": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mem": {
|
||||||
|
"measurement": [
|
||||||
|
"mem_used_percent"
|
||||||
|
],
|
||||||
|
"metrics_collection_interval": 10
|
||||||
|
},
|
||||||
|
"netstat": {
|
||||||
|
"measurement": [
|
||||||
|
"tcp_established",
|
||||||
|
"tcp_time_wait"
|
||||||
|
],
|
||||||
|
"metrics_collection_interval": 10
|
||||||
|
},
|
||||||
|
"swap": {
|
||||||
|
"measurement": [
|
||||||
|
"swap_used_percent"
|
||||||
|
],
|
||||||
|
"metrics_collection_interval": 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user