registering mongo service in consul

This commit is contained in:
Jonathan Math 2021-02-15 19:13:05 -05:00
parent 76d02086f9
commit bf57ef040f
4 changed files with 26 additions and 1 deletions

View file

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

View file

@ -10,3 +10,11 @@
restart_policy: unless-stopped
volumes:
- /srv/newsblur/docker/volumes/db_mongo:/data/db
- name: Register mongo in consul
become: yes
template:
src: consul_service.json
dest: /etc/consul.d/mongo.json
notify:
- reload consul

View file

@ -0,0 +1,9 @@
{
"service": {
"name": "db-mongo",
"tags": [
"db"
],
"port": 27017
}
}

View file

@ -14,4 +14,4 @@
- repo
- {role: 'consul', tags: 'consul'}
- {role: 'consul-client', tags: 'consul'}
- mongo
- {role: 'mongo', tags: 'mongo'}