NewsBlur/ansible/roles/node/tasks/main.yml

57 lines
1.5 KiB
YAML
Raw Normal View History

2021-02-02 23:40:09 -05:00
---
- name: Start node docker containers
become: yes
2021-02-10 17:11:28 -05:00
docker_container:
name: "{{ item.container_name }}"
image: newsblur/newsblur_node
state: started
command: "{{ item.command }}"
container_default_behavior: no_defaults
2021-02-10 17:11:28 -05:00
pull: true
2021-02-24 18:13:26 -05:00
network_mode: host
2021-02-10 17:11:28 -05:00
env:
NODE_ENV: "production"
2021-02-10 17:11:28 -05:00
restart_policy: unless-stopped
volumes:
- /srv/newsblur/node:/srv/node
2021-02-02 23:40:09 -05:00
with_items:
- container_name: node_socket
ports: 8888:8888
command: node /srv/node/unread_counts.js
target_host: 'node-socket'
- container_name: 'original_pages'
ports: '3060:3060'
command: 'node /srv/node/original_page.js'
target_host: 'node-page'
- container_name: 'original_text'
ports: '4040:4040'
command: 'node /srv/node/original_text.js'
target_host: 'node-text'
- container_name: 'favicons'
ports: '3030:3030'
command: 'node /srv/node/favicons.js'
target_host: 'node-favicons'
when: item.target_host in inventory_hostname
2021-02-15 19:16:08 -05:00
- name: Register nodes in consul
tags: consul
2021-02-15 19:16:08 -05:00
become: yes
template:
src: consul_service.json
dest: /etc/consul.d/{{item.target_host}}.json
with_items:
- port: 8888
target_host: 'node-socket'
- port: 3060
target_host: 'node-page'
- port: 4040
target_host: 'node-text'
- port: 3030
target_host: 'node-favicons'
- port: 80
target_host: 'node-images'
2021-02-15 19:16:08 -05:00
notify:
- reload consul
when: item.target_host in inventory_hostname