Skip to content

Commit

Permalink
Merge pull request #21 from companieshouse/feature/cloudwatch-fixes
Browse files Browse the repository at this point in the history
Ensure CloudWatch agent primary config is loaded only after deployment
  • Loading branch information
marcransome authored Aug 9, 2021
2 parents cf56531 + 54f34ed commit 8ed27d8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@
cloudwatch_log_stream_name: "{{ ansible_ec2_instance_id }}_{{ ansible_ec2_hostname }}"
region: "{{ ansible_ec2_instance_identity_document_region }}"

- name: Create CloudWatch agent primary configuration file
template:
src: templates/cloudwatch-config.json.j2
dest: "{{ cloudwatch_agent.config_dir }}/cloudwatch-config.json"
trim_blocks: False

- name: Start CloudWatch agent using primary configuration file
command:
cmd: "{{ cloudwatch_agent.path }} -a fetch-config -m ec2 -s -c file:{{ cloudwatch_agent.config_dir }}/cloudwatch-config.json"

- name: Using constructed variable suffixes
ansible.builtin.debug:
var: "{{ item }}"
Expand Down Expand Up @@ -95,6 +85,16 @@
loop_control:
loop_var: tuxedo_user

- name: Create CloudWatch agent primary configuration file
template:
src: templates/cloudwatch-config.json.j2
dest: "{{ cloudwatch_agent.config_dir }}/cloudwatch-config.json"
trim_blocks: False

- name: Start CloudWatch agent using primary configuration file
command:
cmd: "{{ cloudwatch_agent.path }} -a fetch-config -m ec2 -s -c file:{{ cloudwatch_agent.config_dir }}/cloudwatch-config.json"

- name: Find application-specific CloudWatch configuration files
find:
paths: "{{ cloudwatch_agent.config_dir }}"
Expand Down

0 comments on commit 8ed27d8

Please sign in to comment.