Skip to content

Commit

Permalink
Proxy ping healthcheck
Browse files Browse the repository at this point in the history
* Proxy ping healthcheck
* Telegraf conditional
  • Loading branch information
andrew-pickin-epi committed Mar 27, 2024
1 parent ade15d8 commit 5f3f49c
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 60 deletions.
1 change: 1 addition & 0 deletions roles/docker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@


- name: "AWS ECR docker config directory ( {{ ansible_user_dir }}/.docker )"
become: yes
tags:
- cfg
file:
Expand Down
4 changes: 2 additions & 2 deletions roles/provision/tasks/finalise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
health_check:
ping_protocol: http
ping_port: 80
ping_path: "{{ load_balancers[iter.type].health_check | default('/server-status') }}"
ping_path: "{{ load_balancers[iter.type].health_check | default('/ping') }}"
response_timeout: 5 # seconds
interval: 10 # seconds
unhealthy_threshold: 2
Expand Down Expand Up @@ -156,7 +156,7 @@
health_check:
ping_protocol: http
ping_port: 80
ping_path: "{{ load_balancers[iter.type].health_check | default('/server-status') }}"
ping_path: "{{ load_balancers[iter.type].health_check | default('/'ping) }}"
response_timeout: 5 # seconds
interval: 10 # seconds
unhealthy_threshold: 2
Expand Down
11 changes: 11 additions & 0 deletions roles/proxy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@
- "{{ proxy.directory }}/cache:{{ proxy_cache.directory }}:rw"


- name: "Proxy ping file"
tags:
- proxy
file:
state: "touch"
path : "{{ proxy.directory }}/www/ping"
owner: "root"
group: "root"
mode: "0644"


- name: Proxy cache clean
cron:
name: "Proxy cache clean {{ item.title }}"
Expand Down
8 changes: 4 additions & 4 deletions roles/proxy/templates/localhost.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
CustomLog /dev/null server-status
<Location /server-status>
SetHandler server-status
Order allow,deny
Allow from all
Order deny,allow
Deny from {{ internal_subnet }}
</Location>
<Location /qos>
SetHandler qos-viewer
Order allow,deny
Allow from all
Order deny,allow
Deny from {{ internal_subnet }}
</Location>
57 changes: 3 additions & 54 deletions roles/telegraf/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,4 @@
---
- name: "Discover monitor facts"
setup:
delegate_to: '{{item}}'
delegate_facts: yes
when: hostvars[item]["ansible_all_ipv4_addresses"] is not defined
with_items: '{{groups["monitor"]}}'
- name: "Telegraf"
include_tasks: "Telegraf.yml"
when: telegraf is defined


- name: "Telegraf config directory"
tags:
- cfg
- telegraf
file:
state: "directory"
path : "{{ item }}"
owner: root
group: root
mode: "0755"
loop:
- /etc/telegraf
- /etc/telegraf/telegraf.d


- name: "Telegraf repository"
yum_repository:
name: influxdb
description: InfluxData Repository - Stable
file: influxdb
baseurl: "https://repos.influxdata.com/stable/$basearch/main"
gpgkey: "https://repos.influxdata.com/influxdata-archive_compat.key"
gpgcheck: yes


- name: "Install telegraf"
tags:
- pkg
package:
name: "telegraf"
state: "latest"
notify: "Telegraf service restart"


- name: "Telegraf configuration"
tags:
- cfg
- telegraf
template:
dest: "/etc/telegraf/telegraf.conf"
src: "telegraf.conf.j2"
notify: "Telegraf service restart"


- name: "Services"
include_tasks: "services.yml"
55 changes: 55 additions & 0 deletions roles/telegraf/tasks/telegraf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
- name: "Discover monitor facts"
setup:
delegate_to: '{{item}}'
delegate_facts: yes
when: hostvars[item]["ansible_all_ipv4_addresses"] is not defined
with_items: '{{groups["monitor"]}}'


- name: "Telegraf config directory"
tags:
- cfg
- telegraf
file:
state: "directory"
path : "{{ item }}"
owner: root
group: root
mode: "0755"
loop:
- /etc/telegraf
- /etc/telegraf/telegraf.d


- name: "Telegraf repository"
yum_repository:
name: influxdb
description: InfluxData Repository - Stable
file: influxdb
baseurl: "https://repos.influxdata.com/stable/$basearch/main"
gpgkey: "https://repos.influxdata.com/influxdata-archive_compat.key"
gpgcheck: yes


- name: "Install telegraf"
tags:
- pkg
package:
name: "telegraf"
state: "latest"
notify: "Telegraf service restart"


- name: "Telegraf configuration"
tags:
- cfg
- telegraf
template:
dest: "/etc/telegraf/telegraf.conf"
src: "telegraf.conf.j2"
notify: "Telegraf service restart"


- name: "Services"
include_tasks: "services.yml"

0 comments on commit 5f3f49c

Please sign in to comment.