Rearranging code

This commit is contained in:
Samuel Clay 2021-02-10 17:11:28 -05:00
parent 0cac1d51d5
commit eb7e6bc534
2 changed files with 19 additions and 17 deletions

View file

@ -1,12 +1,15 @@
---
- name: Ensure group "consul" exists
become: true
ansible.builtin.group:
group:
name: consul
state: present
- name: Install Consul
apt:
name: consul
- name: Create config file
ansible.builtin.template:
template:
src: /srv/newsblur/consul/consul.json.j2
dest: /consul.json
dest: /consul.json

View file

@ -1,6 +1,19 @@
---
- name: Start node docker containers
become: yes
docker_container:
name: "{{ item.container_name }}"
image: newsblur/newsblur_node
state: started
command: "{{ item.command }}"
pull: true
ports:
- "{{ item.ports }}"
env:
NODE_ENV: "docker"
restart_policy: unless-stopped
volumes:
- /srv/newsblur/node:/usr/src/app
with_items:
- container_name: node_websocket
ports: 8888:8888
@ -18,18 +31,4 @@
ports: '3030:3030'
command: 'node favicons.js'
target_host: 'node-favicons'
when: "'{{item.target_host}}' in ansible_hostname"
docker_container:
name: "{{ item.container_name }}"
image: newsblur/newsblur_node
state: started
command: "{{ item.command }}"
pull: true
ports:
- "{{ item.ports }}"
env:
NODE_ENV: "docker"
restart_policy: unless-stopped
volumes:
- /srv/newsblur/node:/usr/src/app