registering monitor and haproxy service in consul

This commit is contained in:
Jonathan Math 2021-02-15 19:14:33 -05:00
parent 3989833a5d
commit 61c8e70735
7 changed files with 55 additions and 3 deletions

View file

@ -0,0 +1,9 @@
---
# File: main.yml - Handlers for Consul
- name: reload consul configuration
become: yes
service:
name: consul
state: reloaded
listen: reload consul

View file

@ -18,3 +18,11 @@
- /etc/letsencrypt/live/newsblur.com/:/etc/letsencrypt/live/newsblur.com/
- /etc/letsencrypt/archive/newsblur.com/:/etc/letsencrypt/archive/newsblur.com/
- /srv/newsblur/docker/haproxy:/usr/local/etc/haproxy
- name: Register haproxy in consul
become: yes
template:
src: consul_service.json
dest: /etc/consul.d/haproxy.json
notify:
- reload consul

View file

@ -0,0 +1,9 @@
{
"service": {
"name": "haproxy",
"tags": [
"haproxy"
],
"port": 80
}
}

View file

@ -0,0 +1,9 @@
---
# File: main.yml - Handlers for Consul
- name: reload consul configuration
become: yes
service:
name: consul
state: reloaded
listen: reload consul

View file

@ -12,4 +12,12 @@
- 5000:5000
restart_policy: unless-stopped
volumes:
- /srv/newsblur:/srv/newsblur
- /srv/newsblur:/srv/newsblur
- name: Register monitor in consul
become: yes
template:
src: consul_service.json
dest: /etc/consul.d/monitor.json
notify:
- reload consul

View file

@ -0,0 +1,9 @@
{
"service": {
"name": "monitor",
"tags": [
"www"
],
"port": 5000
}
}

View file

@ -11,8 +11,8 @@
- base
- docker
- {role: 'repo', tags: 'repo'}
- {role: 'letsencrypt', tags: 'letsencrypt'}
- monitor
#- {role: 'letsencrypt', tags: 'letsencrypt'}
- {role: 'consul', tags: 'consul'}
- {role: 'consul-client', tags: 'consul'}
- {role: 'monitor', tags: 'monitor'}
- {role: 'haproxy', tags: 'haproxy'}