mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
registering mongo service in consul
This commit is contained in:
parent
76d02086f9
commit
bf57ef040f
4 changed files with 26 additions and 1 deletions
8
ansible/roles/mongo/handlers/main.yml
Normal file
8
ansible/roles/mongo/handlers/main.yml
Normal 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
|
|
@ -10,3 +10,11 @@
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- /srv/newsblur/docker/volumes/db_mongo:/data/db
|
- /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
|
9
ansible/roles/mongo/templates/consul_service.json
Normal file
9
ansible/roles/mongo/templates/consul_service.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"service": {
|
||||||
|
"name": "db-mongo",
|
||||||
|
"tags": [
|
||||||
|
"db"
|
||||||
|
],
|
||||||
|
"port": 27017
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,4 +14,4 @@
|
||||||
- repo
|
- repo
|
||||||
- {role: 'consul', tags: 'consul'}
|
- {role: 'consul', tags: 'consul'}
|
||||||
- {role: 'consul-client', tags: 'consul'}
|
- {role: 'consul-client', tags: 'consul'}
|
||||||
- mongo
|
- {role: 'mongo', tags: 'mongo'}
|
||||||
|
|
Loading…
Add table
Reference in a new issue